"Gcc-e test.c-o test.i------> preprocessing files generate. i files. 】
- 1, C language Program generation process
- C Language Program generation process can be easily divided into: editing, preprocessing, compilation, assembly, link five order break.
- All of the following operations to the Hello World program for example, the source code file named T.c, the source content is as follows:
- #include <stdio.h>
- int main ()
- {
- printf ("Hello world\n");
- return 0;
- }
- Steps to read
- 2
2. Pretreatment Order Break
Preprocessing order is the preprocessing code in C source processing.
GCC-E-O t.i t.c
Steps to read
- 3
3. Compile order break
Compile order is to process the C source code into the assembly.
Gcc-s-O t.s t.i
Or
Gcc-s-O t.s t.c
Steps to read
- 4
4. Assembly Order Break
The assembly order is to process the assembly code into binary code.
Gcc-c-O t.o t.s
Or
Gcc-c-O t.o t.c
Steps to read
- 5
5. Link Order break
Link order the binary code is packaged into an executable file format that can be recognized by the operating system, and Linux is the ELF format, which is the PE format on Windows.
Gcc-o T T.O
Or
Gcc-o T t.c
Steps to read
-
- 6
- 6. Operation Step Break
- Running the order, the executable loader with the operating system is responsible for loading and executing the program.
- ./T
How to generate preprocessing, compilation and other files with GCC under Linux