Gc++ (GNU Compiler Collection,gnu Compiler Set) is a set of programming language compilers developed by GNU. It is a set of &http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;" The GNU compiler set with free software issued under the GPL and LGPL licenses is a key part of the GNU program, as well as a standard compiler for free Unix-like and Mac OS X operating systems.
GCC was formerly known as the GNU C language compiler because it could only handle the C language. GCC quickly expands to be able to handle C + +. It also becomes available to deal with Fortran, Pascal, C, Java, and Ada and other languages.
The following is a description of the GCC common compilation options:
-C Option:
Compiling the source program into the target code without doing the link work, so the compiled instruction with this option does not generate a final
Executes the program, instead generating an object file with the. o suffix that is the same as the source program file name.
Example: # gcc-c TEST.C
The above command generates only TEST.O files.
-S option:
Use this option to generate only one assembly language file with a suffix named. S.
-E option:
Preprocessing only.
-V Option:
Displays the GCC version.
Example: # gcc-v
-X option:
Specifies the compiled language.
Example: # gcc-x C + + test.c
Indicates that a C + + compiler is used to compile the TEST.C program.
-I option:
Specifies the library and header file path.
In general, most functions under Linux place the header file in the System/usr/include directory, and the library file
is placed in the/usr/lib directory. But in some cases it's not, in these cases, using GCC compile-time
You must specify the path of the desired header file and library file.
Example: # gcc-i/home/include-o Test test.c
Specifies that the header file path is/home/include.
-L Option:
Specifies the path of the dependent library.
-static option:
Forces the program to connect to the static library.
-O Option:
Specifies the file name of the generated executable program.
Example: # Gcc-o Test test.c
Specifies that the test.c file be compiled and the executable file test is generated.
-W Option:
Suppresses the output of warning messages.
-werror option:
Converts all warnings to errors.
-wall option:
Displays all warning messages.
-O Option:
Compile-time Use option-O can tell GCC to reduce the length and execution time of the code at the same time, the effect is equivalent to-o1.
-O2 option:
Option-o2 tells GCC that in addition to completing all the-o1 level optimizations, there are some additional adjustments to be made,
such as processor instruction scheduling.
-G option:
Generate debugging information.
-PG option:
Once the compilation is complete, additional information is required for profiling.