gcc,g++

http://www.360doc.com/content/12/0211/08/6828497_185707599.shtml    


   gcc [-c|-S|-E] [-std=standard]

           [-g] [-pg] [-Olevel]
           [-Wwarn...] [-pedantic]
           [-Idir...] [-Ldir...]
           [-Dmacro[=defn]...] [-Umacro]
           [-foption...] [-mmachine-option...]

           [-o outfile] infile...

-O 优化,分0,、1、2、3、s

                 -Os为优化尺寸。

-S 汇编编译

-E 只做预处理,不做编译

-c 只是编译,不链接

-fPIC --- Position-independent code ,用于动态库

-o 输出

-g gdb调试类型

-I 搜索的路径

-L 动态库查找的路径

-Wl, option 如-Wl,-rpath .  用于link操作

-Wa用于汇编

-Wp用于预处理

 -static 阻止连接动态库,指定连接静态库

-shared 生成动态库,和-fpic结合使用


对于预处理:

       -I dir
           Add the directory dir to the list of directories to be searched for header files.  Directories named by -I are searched before the standard system
           include directories.  If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for
           system directories and the special treatment of system headers are not defeated . --------- 如果-I指定目录和标准系统目录重复,则认为是系统目录。

       -I- ------------ 这个选项已经被弃用。

       -isystem dir
           Search dir for header files, after all directories specified by -I but before the standard system directories.  Mark it as a system directory, so
           that it gets the same special treatment as is applied to the standard system directories.------------ 指定为系统目录。其顺序先于标准系统目录。
       -iquote dir
           Search dir only for header files requested with "#include "file""; they are not searched for "#include <file>", before all directories specified by
           -I and before the standard system directories. ------------ 只对#include “file”类型有效。

       #include “file”类型:先-iquote,再-I,再-isystem,再标准系统目录;

       #include <file>类型:先-isystem,再标准系统目录,再-I;


对于编译:

       -Idir
           Add the directory dir to the head of the list of directories to be searched for header files.  This can be used to override a system header file,
           substituting your own version, since these directories are searched before the system header file directories.  However, you should not use this
           option to add directories that contain vendor-supplied system header files (use -isystem for that).  If you use more than one -I option, the directo-
           ries are scanned in left-to-right order; the standard system directories come after.    -------------- 用于覆盖系统头文件;如果多个-I选项,则按照从左到右顺序,系统目录最后。

           If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option will be ignored.  The direc-
           tory will still be searched but as a system directory at its normal position in the system include chain.  This is to ensure that GCC's procedure to
           fix buggy system headers and the ordering for the include_next directive are not inadvertently changed.  If you really need to change the search
           order for system directories, use the -nostdinc and/or -isystem options.  


       -iquotedir
           Add the directory dir to the head of the list of directories to be searched for header files only for the case of #include "file"; they are not
           searched for #include <file>, otherwise just like -I.    --- 同上。


       -Ldir
           Add directory dir to the list of directories to be searched for -l. --------搜索动态库


       -Bprefix
           This option specifies where to find the executables, libraries, include files, and data files of the compiler itself.    ------- 指定哪发现可执行文件,库文件,头文件等。
           The compiler driver program runs one or more of the subprograms cpp, cc1, as and ld.  It tries prefix as a prefix for each program it tries to run,
           both with and without machine/version/.
           For each subprogram to be run, the compiler driver first tries the -B prefix, if any.  If that name is not found, or if -B was not specified, the
           driver tries two standard prefixes, which are /usr/lib/gcc/ and /usr/local/lib/gcc/.  If neither of those results in a file name that is found, the
           unmodified program name is searched for using the directories specified in your PATH environment variable.
           The compiler will check to see if the path provided by the -B refers to a directory, and if necessary it will add a directory separator character at
           the end of the path.
           -B prefixes that effectively specify directory names also apply to libraries in the linker, because the compiler translates these options into -L
           options for the linker.  ------------------ 被编译器当做-L使用。

           They also apply to includes files in the preprocessor, because the compiler translates these options into -isystem options

           for the preprocessor.  In this case, the compiler appends include to the prefix.  ---------------- 被当做-isystem使用。
           The run-time support file libgcc.a can also be searched for using the -B prefix, if needed.  If it is not found there, the two standard prefixes
           above are tried, and that is all.  The file is left out of the link if it is not found by those means.
           Another way to specify a prefix much like the -B prefix is to use the environment variable GCC_EXEC_PREFIX.
           As a special kludge, if the path provided by -B is [dir/]stageN/, where N is a number in the range 0 to 9, then it will be replaced by [dir/]include.
           This is to help with boot-strapping the compiler.


Option Summary


       Here is a summary of all the options, grouped by type.  Explanations are in the following sections.


       Overall Options
           -c  -S  -E  -o file  -combine -pipe  -pass-exit-codes -x language  -v  -###  --help  --target-help  --version


       C Language Options
           -ansi  -std=standard  -fgnu89-inline -aux-info filename -fno-asm  -fno-builtin  -fno-builtin-function -fhosted  -ffreestanding  -fms-extensions -tri-
           graphs  -no-integrated-cpp  -traditional  -traditional-cpp -fallow-single-precision  -fcond-mismatch -fsigned-bitfields  -fsigned-char -fun-
           signed-bitfields  -funsigned-char


       C++ Language Options
           -fabi-version=n  -fno-access-control  -fcheck-new -fconserve-space  -ffriend-injection  -fno-const-strings -fno-elide-constructors
           -fno-enforce-eh-specs -ffor-scope  -fno-for-scope  -fno-gnu-keywords -fno-implicit-templates -fno-implicit-inline-templates -fno-implement-inlines
           -fms-extensions -fno-nonansi-builtins  -fno-operator-names -fno-optional-diags  -fpermissive -frepo  -fno-rtti  -fstats  -ftemplate-depth-n
           -fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ -fno-default-inline  -fvisibility-inlines-hidden -Wabi  -Wctor-dtor-privacy
           -Wnon-virtual-dtor  -Wreorder -Weffc++  -Wno-deprecated  -Wstrict-null-sentinel -Wno-non-template-friend  -Wold-style-cast -Woverloaded-virtual
           -Wno-pmf-conversions -Wsign-promo


       Objective-C and Objective-C++ Language Options
           -fconstant-string-class=class-name -fgnu-runtime  -fnext-runtime -fno-nil-receivers -fobjc-call-cxx-cdtors -fobjc-direct-dispatch -fobjc-exceptions
           -fobjc-gc -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept -Wno-protocol  -Wselector -Wstrict-selector-match -Wundeclared-selector


       Language Independent Options
           -fmessage-length=n -fdiagnostics-show-location=[once|every-line] -fdiagnostics-show-options


       Warning Options
           -fsyntax-only  -pedantic  -pedantic-errors -w  -Wextra  -Wall  -Waggregate-return -Wno-attributes -Wc++-compat -Wcast-align  -Wcast-qual  -Wchar-sub-
           scripts  -Wcomment -Wconversion  -Wno-deprecated-declarations -Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels -Werror  -Wer-
           ror-implicit-function-declaration -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 -Wno-format-extra-args -Wformat-nonliteral -Wformat-security
           -Wformat-y2k -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int -Wimport  -Wno-import  -Winit-self  -Winline -Wno-int-to-pointer-cast
           -Wno-invalid-offsetof  -Winvalid-pch -Wlarger-than-len  -Wunsafe-loop-optimizations  -Wlong-long -Wmain  -Wmissing-braces  -Wmissing-field-initializ-
           ers -Wmissing-format-attribute  -Wmissing-include-dirs -Wmissing-noreturn -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded -Wparentheses
           -Wpointer-arith  -Wno-pointer-to-int-cast -Wredundant-decls -Wreturn-type  -Wsequence-point  -Wshadow -Wsign-compare  -Wstack-protector
           -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch  -Wswitch-default  -Wswitch-enum -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized -Wun-
           known-pragmas  -Wno-pragmas -Wunreachable-code -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter -Wunused-value  -Wunused-variable
           -Wvariadic-macros -Wvolatile-register-var  -Wwrite-strings


       C-only Warning Options
           -Wbad-function-cast  -Wmissing-declarations -Wmissing-prototypes  -Wnested-externs  -Wold-style-definition -Wstrict-prototypes  -Wtraditional -Wdec-
           laration-after-statement -Wpointer-sign


       Debugging Options
           -dletters  -dumpspecs  -dumpmachine  -dumpversion -fdump-unnumbered  -fdump-translation-unit[-n] -fdump-class-hierarchy[-n] -fdump-ipa-all
           -fdump-ipa-cgraph -fdump-tree-all -fdump-tree-original[-n] -fdump-tree-optimized[-n] -fdump-tree-inlined[-n] -fdump-tree-cfg -fdump-tree-vcg
           -fdump-tree-alias -fdump-tree-ch -fdump-tree-ssa[-n] -fdump-tree-pre[-n] -fdump-tree-ccp[-n] -fdump-tree-dce[-n] -fdump-tree-gimple[-raw]
           -fdump-tree-mudflap[-n] -fdump-tree-dom[-n] -fdump-tree-dse[-n] -fdump-tree-phiopt[-n] -fdump-tree-forwprop[-n] -fdump-tree-copyrename[-n]
           -fdump-tree-nrv -fdump-tree-vect -fdump-tree-sink -fdump-tree-sra[-n] -fdump-tree-salias -fdump-tree-fre[-n] -fdump-tree-vrp[-n] -ftree-vector-
           izer-verbose=n -fdump-tree-storeccp[-n] -feliminate-dwarf2-dups -feliminate-unused-debug-types -feliminate-unused-debug-symbols -fmem-report -fpro-
           file-arcs -frandom-seed=string -fsched-verbose=n -ftest-coverage  -ftime-report -fvar-tracking -g  -glevel  -gcoff -gdwarf-2 -ggdb  -gstabs  -gstabs+
           -gvms  -gxcoff  -gxcoff+ -p  -pg  -print-file-name=library  -print-libgcc-file-name -print-multi-directory  -print-multi-lib -print-prog-name=program
           -print-search-dirs  -Q -save-temps  -time


       Optimization Options
           -falign-functions[=n]  -falign-jumps[=n] -falign-labels[=n]  -falign-loops[=n] -fmudflap -fmudflapth -fmudflapir -fbranch-probabilities -fpro-
           file-values -fvpt -fbranch-target-load-optimize -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves  -fcprop-registers  -fcse-fol-
           low-jumps -fcse-skip-blocks  -fcx-limited-range  -fdata-sections -fdelayed-branch  -fdelete-null-pointer-checks -fearly-inlining -fexpensive-opti-
           mizations  -ffast-math  -ffloat-store -fforce-addr  -ffunction-sections -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las  -fgcse-after-reload -floop-optimize
           -fcrossjumping  -fif-conversion  -fif-conversion2 -finline-functions  -finline-functions-called-once -finline-limit=n  -fkeep-inline-functions
           -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants -fmodulo-sched -fno-branch-count-reg -fno-default-inline  -fno-defer-pop -floop-opti-
           mize2 -fmove-loop-invariants -fno-function-cse  -fno-guess-branch-probability -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 -fun-
           safe-math-optimizations  -funsafe-loop-optimizations  -ffinite-math-only -fno-trapping-math  -fno-zero-initialized-in-bss -fomit-frame-pointer  -fop-
           timize-register-move -foptimize-sibling-calls  -fprefetch-loop-arrays -fprofile-generate -fprofile-use -fregmove  -frename-registers -freorder-blocks
           -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop  -frerun-loop-opt -frounding-math -fschedule-insns  -fschedule-insns2
           -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load -fsched-spec-load-dangerous -fsched-stalled-insns[=n] -fsched-stalled-insns-dep[=n]
           -fsched2-use-superblocks -fsched2-use-traces -freschedule-modulo-scheduled-loops -fsignaling-nans -fsingle-precision-constant -fstack-protector
           -fstack-protector-all -fstrength-reduce  -fstrict-aliasing  -ftracer  -fthread-jumps -funroll-all-loops  -funroll-loops  -fpeel-loops
           -fsplit-ivs-in-unroller -funswitch-loops -fvariable-expansion-in-unroller -ftree-pre  -ftree-ccp  -ftree-dce -ftree-loop-optimize -ftree-loop-linear
           -ftree-loop-im -ftree-loop-ivcanon -fivopts -ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink -ftree-ch -ftree-sra -ftree-ter -ftree-lrs
           -ftree-fre -ftree-vectorize -ftree-vect-loop-version -ftree-salias -fweb -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -ftree-vrp
           -funit-at-a-time -fwhole-program --param name=value -O  -O0  -O1  -O2  -O3  -Os


       Preprocessor Options
           -Aquestion=answer -A-question[=answer] -C  -dD  -dI  -dM  -dN -Dmacro[=defn]  -E  -H -idirafter dir -include file  -imacros file -iprefix file
           -iwithprefix dir -iwithprefixbefore dir  -isystem dir -isysroot dir -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc -P  -fworking-directory  -remap -tri-
           graphs  -undef  -Umacro  -Wp,option -Xpreprocessor option


       Assembler Option
           -Wa,option  -Xassembler option


       Linker Options
           object-file-name  -llibrary -nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic
           -Wl,option  -Xlinker option -u symbol


       Directory Options
           -Bprefix  -Idir  -iquotedir  -Ldir -specs=file  -I- --sysroot=dir


       Target Options
           -V version  -b machine


       Machine Dependent Options(内容省略)


       Code Generation Options
           -fcall-saved-reg  -fcall-used-reg -ffixed-reg  -fexceptions -fnon-call-exceptions  -funwind-tables -fasynchronous-unwind-tables -finhibit-size-direc-
           tive  -finstrument-functions -fno-common  -fno-ident -fpcc-struct-return  -fpic  -fPIC -fpie -fPIE -fno-jump-tables -freg-struct-return
           -fshared-data  -fshort-enums -fshort-double  -fshort-wchar -fverbose-asm  -fpack-struct[=n]  -fstack-check -fstack-limit-register=reg
           -fstack-limit-symbol=sym -fno-stack-limit  -fargument-alias  -fargument-noalias -fargument-noalias-global  -fleading-underscore -ftls-model=model
           -ftrapv  -fwrapv  -fbounds-check -fvisibility  -fopenmp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值