[Detailed parameters]
-C
Only activates preprocessing, compilation, and assembly, that is, he only makes the program obj file
Example usage:
Gcc-c hello.c
He will generate the. O obj file
-S
Only pre-processing and compilation are activated, which means compiling the files into assembly code.
Example usage
Gcc-s hello.c
He will generate the assembly code for. S, which you can view with a text editor
-E
Just activate preprocessing, this does not generate files, you need to redirect it to an output file
Surface.
Example usage:
GCC-E hello.c > Pianoapan.txt
GCC-E hello.c | More
Look slowly, a Hello word also wants to work with code that is processed into 800 lines
-O
Set the target name, by default, GCC compiled files are a.out, it is difficult to listen, if you and I have the same feeling, to change it, haha
Example usage
Gcc-o hello.exe hello.c (Oh, Windows is used to it)
Gcc-o hello.asm-s hello.c
-ansi
Turn off the features in GNU C that are incompatible with ANSI C and activate the exclusive features of ANSI C (including the prohibition of a
ASM Inline typeof keywords, as well as preprocessing macros such as Unix,vax,
-wall
Display warning message
-o0
-o1  
-o2
-o3
4 levels of the compiler's optimization options,-o0 indicates no optimizations,-O1 is the default value,- O3 optimization level  
High
 
-g
just compiler, The debug information is generated at compile time.
-llibrary
Create a library to use when compiling
Example usage
Gcc-lcurses hello.c
Compiling a program using the Ncurses Library
-ldir
When compiling, search for the path to the library. such as your own library, you can use it to create a directory, or
The compiler will only look in the catalog of the standard library. This dir is the name of the directory.
-gstabs
This option claims debug information in stabs format, but does not include GDB debugging information.
-gstabs+
This option claims debug information in the stabs format and contains additional debugging information that is intended for use by GDB only.
-ggdb
This option will generate the debug information that GDB can use whenever possible.
-static This option disables the use of dynamic libraries, so the compiled items are generally large and do not require any dynamic connection libraries to run.
-share This option will use the dynamic library as much as possible, so the resulting file is smaller, but requires the system to be a dynamic library.
-traditional trying to get the compiler to support traditional C language features
-fno-asm
This option implements the functionality of the ANSI option, which prohibits the use of asm,inline and typeof as
 
-fno-strict-prototype
only works with g++, using this option, g++ Any function that does not have an argument is considered to have no explicit
Ming type
 
- FTHIS-IS-VARIALBLE 
-fcond-mismatch
allow the second and third parameter types of the conditional expression to be mismatched, the value of the expression will be void type
 
-funsigned-char
-fno-signed-char
-fsigned-char
-fno-unsigned-char
These four parameters are set on the char type, and decide to set the char type to unsigned char (ex
-include file
Contains a code, in short, that is, a file, you need another file, you can
With this setting, the function is equivalent to using # Include in the code
Example usage:
GCC Hello.c-include/root/pianopan.h
-imacros file
To extend the file's macro to the gcc/g++ input file, the macro definition itself does not appear in the input file
In
-dmacro
Equivalent to # define macro in C language
-dmacro=defn
The equivalent of # define MACRO=DEFN in the C language
-umacro
Equivalent to #undef macro in C language
-undef
To cancel the definition of any non-standard macro
-idir
When you use # include "File", gcc/g++ will find the header you made in the current directory first.
File, if not found, he returns to the default header file directory to find, if using-I developed a directory, he
Go back to the directory you have set up, and then follow the usual sequence to find it.
For the #include,gcc/g++ will go to-I developed directory lookup, not found, and then to the department
Default header file directory lookup for the
-i-
is to cancel the function of the previous parameter, so it is generally used after-idir
-idirafter dir
Look for a failure in the-I directory, refer to this directory to find.
-iprefix Prefix
-iwithprefix dir
Generally used together, when-I directory lookup failed, will be found under Prefix+dir
-nostdinc
Make the compiler no longer the system default header file directory inside the your change file, general and-I joint use, clear
Location of the qualified header file
-nostdin C + +
The rule does not search in the standard path specified by g++, but still searches in other paths. This option creates
libg++ Library Use
-C
In the preprocessing, do not delete the annotation information, general and e-use, and sometimes analytical procedures, with this very
Convenient for
-M
Generates information about the file association. Contains all source code that the destination file depends on
You can test it with gcc-m hello.c, it's simple.
-mm
The same as the one above, but it ignores dependencies caused by # include.
-md
Same as-M, but the output will be imported into the. d file
-mmd
Same as-mm, but the output will be imported into the. d file.
-wa,option
This option passes option to the assembler; if option has commas in the middle, the option is divided into multiple selected
Item, which is then passed to the Assembly program
-wl.option
This option passes option to the connector, and if option has a comma, the option is divided into multiple options, which are then passed to the connecting program.
-X language filename Sets the language used for the file, so that the suffix name is invalid for later multiple valid. That is, according to the Convention C language suffix name is. c, while the C + + suffix name is. C or. cpp, if you are very personality, decide your C code file's suffix name is. Pig Haha, then you'll use this parameter, which will work on the file name behind him unless the next parameter is used. Can I use parameters like these ' C ', ' objective-c ', ' c-header ', ' C + ', ' cpp-output ', ' assembler ', and ' assembler-with-cpp '. It should be understandable to see English. Example usage: gcc-x C hello.pig
-X None filename turns off the previous option, which is to allow GCC to automatically identify file types based on the filename suffix usage: gcc-x c hello.pig-x None hello2.c
-pipe the use of pipelines instead of temporary files in the compilation, there may be some problems when using non-GNU assembler tools Gcc-pipe-o hello.exe hello.c
-funsigned-char-fno-signed-char-fsigned-char-fno-unsigned-char These four parameters are set on the char type and decide to set the char type to unsigned char (the first two arguments ) or signed char (the latter two parameters)
The parameters of GCC are many, and this is only part of it. But for beginners, it is difficult to master so many parameters at a moment, but it is generally recommended to use the command: Gcc-wall hello.c-o Hello is enough. Generally use-wall This parameter, he can list the source program in the compilation process error warning and other information, this is very helpful, note:-wall This parameter is used in the compilation process, if the source program is compiled into a target file, the link process do not use this parameter. You can also add a-v parameter: Lists the more detailed information, (in the standard error) shows the command to perform the compile phase. Also displays the compiler driver, the preprocessor, and the compiler's version number.
GCC Common Parameter Enumeration