During cross-platform development, many problems are related to the compiler. So let's talk about compiler problems first.
★Compiler Selection
First, GCC is preferred, because almost all operating system platforms have GCC available. It is basically a general compiler. If your code can be compiled through GCC on platform A and then compiled using a version similar to GCC on platform B, there will be no major problem. Therefore, GCC must consider support.
Second, consider whether local compilers are supported. The local compiler is the compiler developed by the operating system vendor. For example, compared with the Windows Local compiler
C ++. The local compiler of Solaris is Sun's CC. If you are sensitive to performance or want to use advanced features of some local compilers, you may have to consider supporting GCC and local compilers.
★Compile warning
The compiler is a programmer's friend. Many potential problems (including portability) can be found and given warnings by the compiler. if you pay attention to these warnings, it can reduce a lot of trouble. Therefore, I strongly recommend that:1. Increase the warning level of the compiler. 2. Do not ignore the warning information of the compiler.
★Cross Compiler
For cross-compiler definitions, see Wikipedia ".
In layman's terms, it is to compile binary programs running on platform B on platform. Assume that the application you want to develop is running on Solaris, but you do not have a Linux host that can run Solaris. In this case, the cross compiler can be used. Generally, GCC is used to create a cross-compiler. We will not go into detail here. If you are interested, refer to "here ".
Let's talk about the compiler. Let's talk about the syntax later.
Http://program-think.blogspot.com/2009/01/cxx-cross-platform-develop-1-compiler.html