Compiler compilation process

Source: Internet
Author: User

The compilation process consists of four major steps: preprocessing, compilation, compilation, and linking. Preprocessing mainly involves macro definition replacement, file inclusion, and Conditional compilation. Use the # ifndef mechanism to prevent the following situation: File A contains a header file C, and file B also contains the header file C, and file a contains header file B, if the # ifndef structure is used, errors can be avoided during compilation, but the header file is defined (including functions, arrays, and variables) when linking, an error will be reported because multiple objects contain the same object. This error is a link error rather than a compilation error. Therefore, it must be noted that only declarations can be made in the header file, cannot be defined. In addition, note the difference between the include backend angle brackets and double quotation marks. The angle brackets tell the compiler to first find the header file from the library already included during software installation, double quotation marks tell the compiler to first find the header file under the specified directory. Compiling is to convert the preprocessing result into an assembly language, and the compilation result is to translate the result into a machine code. The link is to synthesize an executable file by combining various functions, the concept of the database is involved here.

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.