For example, the C executable file is generated in four steps in the box:
1. Preprocessing: the preprocessing result is still a c file, but it is suffixed with. I. The so-called preprocessing process starts with #, for example, # include <stdio. h>, the pre-processor will read the file stdio. h Insert the file content directly in # include <stdio. h>. It will also process the # define macro.
2. CCL converts. I to an assembly language. Each assembly statement describes a machine instruction. The assembly language provides a common output language for different compilers and different advanced languages. For example, C and FORTRAN generate the same assembly language.
3. Convert to machine commands .. The o file is a binary file that uses machine instruction encoding instead of character encoding. So if you use a text editor to view the. o file, it looks messy.
4. Link stage. Our C program may use other compiled. O files. For example, if printf is used, the printf. o file must be integrated with our. o file. The connector executes this fusion and generates executable files.
The compilation process of C ++ is similar to that of C. It is first converted to C before other processes.