To convert a file named filename. C to a runable file, you need to perform the following steps. Take helloworld. C as an example.
Helloworld. c
|
| During the preprocessing process, GCC-e helloworld. C-o helloworld. I is obtained, and the helloworld. I file is obtained.
|
Helloworld. I
|
| Gcc-s helloworld. I in the assembly process, and the helloworld. s file is obtained.
|
Helloworld. s
|
| During the compilation process, GCC-C helloworld. s gets the helloworld. o file.
|
Helloworld. o
|
| Gcc-O helloworld. O to get the executable program helloworld
|
Helloworld
The GCC-e command can process the. c file.
The GCC-s command can process. I or. c files.
The GCC-C command can process. S,. I, or. c files.
The GCC-O command can process. O,. S,. I, or. c files.
Therefore, the executable program can be obtained step by step from the source program. You can also start from the intermediate step. For example, GCC-C can be compiled first, and then gcc-O can be linked to an executable program. Of course, it is generally completed in one step, GCC-O helloworld. c
So far, we can intuitively understand why C Programming textbooks say, C program compilation will go through "preprocessing", "assembly", "Compilation", and "Link" steps.