The process of compiling C++ source code

The process of compiling C++ source code consists of four stages:

  1. Preprocessing: In this stage, the source code is processed using a preprocessor and a preprocessed intermediate file is generated.

The generated files are usually intermediate files with .ior .iiextensions such as HelloWorld.i or HelloWorld.ii.

2. Compilation: At this stage, the preprocessed intermediate file is compiled into an object file expressed in assembly language.

The resulting file is usually an assembly language file with an extension of .sor , for example, HelloWorld.s or HelloWorld.asm..asm

3. Assembly (Assembling): At this stage, the assembler assembles the object files expressed in assembly language into machine-readable object files.

The generated file is an object file with .oor .objextension, eg HelloWorld.o or HelloWorld.obj.

4. Linking (Linking): At this stage, the linker links the various object files and library files to generate the final executable program.

The generated file is usually an executable file or a dynamic link library file with the extension of , .exeor .dll, such as HelloWorld.exe..so

Therefore, the combination of these four stages is also called "Preprocessing, Compilation, Assembly and Linking" (Preprocessing, Compilation, Assembly and Linking, referred to as PCAL).

Guess you like

Origin blog.csdn.net/qq_42898149/article/details/131030746