Portability and cross-platform development of C ++ [1]: Compiler

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.