C ++ compilation and link (1)-compilation and link Process

Source: Internet
Author: User

We all know how a series of C ++ language programs, 1 and 0, are used by computers to change from. h and. cpp files to executable files containing 1 and 0? It can be considered that there are several phases of the source program-> preprocessing-> compilation and Optimization-> generating the target file-> link-> Executable File 1. preprocessing of C ++ refers to the processing of C ++ program source code by the pre-processor before the C ++ program source code is compiled. This process does not parse the source code of the program. Preprocessor refers to an independent program called by the compiler before the actual compilation starts. The pre-processor is mainly responsible for the following: 1. macro replacement 2. delete comment 3. process preprocessing commands, such as # include, # ifdef. If we have the following code: temp. h copy the Code # ifndef _ HEADERNAME_H # define _ HEADERNAME_H 1 # include <iostream> inline void show (char * a) {std: cout <a <std: endl; // annotation} # endif copy the code main. cpp copy Code # include "temp. h "# define MACRO" This is a macro "extern int I; int main () {std: cout <I <std: endl; show (MACRO );

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.