g常用编译选项(Gcommoncompileoptions)
g++常用编译选项(G++ common compile options)
Compile options for GCC and g++ in Linux
-x language filename
Use the file set language, the suffix name is invalid, the more effective later. That is according to the agreement, C language suffix name is.C, and the C++ suffix is.C or.Cpp, if you have a personality, determine your C code file name suffix is.Pig ha ha, you to use this parameter, the parameters of the file names behind him play, unless the use of a parameter. The parameters you can use have the following:
`c', `objective-c', `c-header', `c++', `cpp-output', `assembler', and, `a
Ssembler-with-cpp'.
It should be understandable to see english.
Example use: cd..
GCC -x C hello.pig
-x none filename
Turn off the last option, that is, GCC automatically identifies the file type based on the file name suffix
Example usage:
GCC, -x, C, hello.pig, -x, none, hello2.c
-c
Activation, preprocessing, compilation, and assembly only, that is, he only makes programs into obj files
Example usage:
GCC -c hello.c
He will generate the.O obj file
-S
Activation, preprocessing, and compilation only refer to the compilation of files into assembly code.
Example usage
GCC -S hello.c
He will generate the assembly code for.S, which you can look at in a text editor
-E
Activate preprocessing only. This does not generate files, and you need to redirect it to an output file
Example usage:
GCC, -E, hello.c > pianoapan.txt
GCC -E hello.c more |
Take a look at it. A hello word also needs to be pre processed into 800 lines of code
-o
Set the target name. By default, the GCC compiles the file is a.out. It's hard to hear. If you feel the same way, get rid of it, ha ha
Example usage
GCC, -o, hello.exe, hello.c (oh, windows used it)
GCC, -o, hello.asm, -S, hello.c
-pipe
Using pipes instead of temporary files in compilation can be a problem when using non - GNU assembly tools
GCC, -pipe, -o, hello.exe, hello.c
-ansi
Close the incompatibility in GNU C with ANSI C to activate the proprietary features of ANSI