gcc的一些option
-c: compileor assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.
By default, the object file name for a source file is made by replacing the suffix '.c', '.i', '.s', etc., with '.o':可以看到,这里生成的.o文件并不是可执行文件,因此./file.o并不能执行
-o file_name: Place output in file file_name.
If '-o' is not specified, the default is to put an executable file in 'a.out', the object file for 'source.suffix' in 'source.o', its assembler file in 'source.s', a precompiled header file in 'source.suffix.gch', and all preprocessed C source on standard output
-v: Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper.
--help: Print (on the standard output) a description of the command line options understood by gcc. If the '-v' option is also specified then '--help' will also be passed on to the varous processes invoked by gcc, so that they can display the command line options they accept.
--version: Display the version number and copyrights of the invoked GCC
-ansi: 用标准C模式或者标准C++模式
-fsyntax-only: Chek the code for syntax errors, but donot do anything beyond that.
-w: Inhibit all warning messages
-Werror: Make all warnings into errors.
-Werror=: Make the specified warning into an error.
-Wunused: 包括-Wunused-function, -Wunused-label, -Wunused-parameter, -Wunused-variable, -Wunused-value
-Wuninitiallized: Warn if an automatic variable is used without first being initialized of if a variable may be clobberd by a setjmp call.
-Wno-div-by-zero: Donot warn about compile-time integer division by zero.
-Wreturn-type: 函数返回值类型的warning
-fno-inline: Donot pay attention to the inline keyword. Normally this option is used to keep the compiler from expanding any functions inline. Note that if you are not optimizing, no functions can be expanded inline.
-finline-functions: Integrate all simple functions into their callers. The compiler heuristically decides which functions are simple enough to be worth integrating in this way. If all calls to a given functions are integrated, and the function is declared static, then the function is normally not output as assembler code in its own rigth.
-w: Suppress all warnings, including those which GNU CPP issues by default
posted on 2009-09-02 14:39 vincenzo.lai 阅读(1172) 评论(0) 收藏 举报