Usage: gcc [...] filenames
Example: GCC hello.c
Output: a.out
Procedure: hello.c pre-mutation hello.i after compilation Hello.s post hello.o link after hello
Pre-compilation:
GCC-E Hello.c-o hello.i
Compile:
Gcc-s Hello.i-o Hello.s
Assembly:
Gcc-c Hello.s-o hello.o
Link:
GCC Hello.o-o Hello
File format:
*.C C Language Source code
*.h header File
*.A Library file
*.O target file
*. C *.cc *.cpp C + + files
*.S *. S assembly File
GCC compilation options:
-o Specifies the output executable file
-O to optimize the compilation of the program
-o2 better compiling for the program, consuming more time
-C only compile not connected, output *.O target file
-G produces the required symbols for GDB for debugging
Linux system header files are generally stored in the/usr/include, if the header file is stored in the current directory, the reference format is:
#include "XXX.h"
Or, use the-I option to specify where the header file is stored, such as:
Gcc-i/root Hello.c-o Hello
Pre-compiled use:
#define PRINT
#ifdef PRINT
...
#endif
This article is from the "Home Life" blog, please be sure to keep this source http://elvin1122.blog.51cto.com/9889796/1838340
0-15 GCC Program compilation