Create a C source file in the current directory and open it:
Touch Test.cgedit test.c
Direct compilation:
GCC Test.c-o Test
To compile in steps:
1) pretreatment
GCC-E Test.c-o test.i
In the current directory will be more than a preprocessing result file test.i, open test.i can see, on the basis of test.c stdio.h and stdlib.h the contents of the inserted.
2) Compile as assembly code
Gcc-s Test.i-o Test.s
Where-s parameter is exited after compilation is complete,-O is the specified file name.
3) assembly as the target file
Gcc-c Test.s-o TEST.O
. O is the target file. The target file is similar to an executable file, which is the executable code that the machine recognizes, but the structure is slightly different because there are no links.
3) Link and generate the executable file
GCC Test.o-o Test
The process of generating executable files in C language under Linux