gcc

来源:互联网 发布:windows程序设计百度云 编辑:程序博客网 时间:2024/04/27 16:55

Notice:

1、-v和--version的作用并不总是一致;

2、


(Display compiler version information)

$ gcc --version

gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 (Display the programs invoked by the compiler编译器将会调用到的程序)

$ gcc -v 

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)


$ gcc --help

Usage: gcc [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]
                           Display specific types of command line options


(Use '-v --help' to display command line options of sub-processes)

sub-processes的命令行选项


--version                Display compiler version information

$ gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-dumpspecs               Display all of the built in spec strings



-dumpversion             Display the version of the compiler

$ gcc -dumpversion
4.4.5


-dumpmachine             Display the compiler's target processor

$ gcc -dumpmachine
x86_64-linux-gnu


-print-search-dirs       Display the directories in the compiler's search path

$ gcc -print-search-dirs
install: /usr/lib/gcc/x86_64-linux-gnu/4.4.5/
programs: =/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/libexec/gcc/x86_64-linux-gnu/4.4.5/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/bin/
libraries: =/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../x86_64-linux-gnu/4.4.5/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/:/lib/x86_64-linux-gnu/4.4.5/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/4.4.5/:/usr/lib/../lib/:/usr/lib/x86_64-linux-gnu/x86_64-linux-gnu/4.4.5/:/usr/lib/x86_64-linux-gnu/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../:/lib/:/usr/lib/:/usr/lib/x86_64-linux-gnu/


-print-libgcc-file-name  Display the name of the compiler's companion library

$ gcc -print-libgcc-file-name
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/libgcc.a


-print-file-name=<lib>   Display the full path to library <lib>

显示lib的全路径


-print-prog-name=<prog>  Display the full path to compiler component <prog>

显示编译器组件prog的全路径


-print-multi-directory   Display the root directory for versions of libgcc



-print-multi-lib         Display the mapping between command line options and multiple library search directories


-print-multi-os-directory Display the relative path to OS libraries


-print-sysroot           Display the target libraries directory

-print-sysroot-headers-suffix Display the sysroot suffix used to find headers


-Wa,<options>            Pass comma-separated <options> on to the assembler

给汇编器传递options
-Wp,<options>            Pass comma-separated <options> on to the preprocessor

给预处理器传递options
-Wl,<options>            Pass comma-separated <options> on to the linker

给链接器传递options


-Xassembler <arg>        Pass <arg> on to the assembler

给汇编器传递参数
-Xpreprocessor <arg>     Pass <arg> on to the preprocessor

给预处理器传递参数
-Xlinker <arg>           Pass <arg> on to the linker

给链接器传递参数


-combine                 Pass multiple source files to compiler at once
-save-temps              Do not delete intermediate files
-pipe                    Use pipes rather than intermediate files
-time                    Time the execution of each subprocess

记录每个subprocess的执行时间


-specs=<file>            Override built-in specs with the contents of <file>
-std=<standard>          Assume that the input sources are for <standard>
--sysroot=<directory>    Use <directory> as the root directory for headers and libraries


-B <directory>           Add <directory> to the compiler's search paths

为搜索路径添加目录
-b <machine>             Run gcc for target <machine>, if installed

运行指定目标machine的gcc
-V <version>             Run gcc version number <version>, if installed

运行指定version的gcc


-v                       Display the programs invoked by the compiler
-###                     Like -v but options quoted and commands not executed

-E                       Preprocess only; do not compile, assemble or link

预处理,不编译,不汇编,不链接
-S                       Compile only; do not assemble or link

编译,不汇编,不链接
-c                       Compile and assemble, but do not link

编译,汇编,不链接
-o <file>                Place the output into <file>

指定生成的可执行文件的名字为file
-x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none, 'none' means revert to the default behavior of guessing the language based on the file's extension


Options starting with -g, -f, -m, -O, -W, or --param are automatically passed on to the various sub-processes invoked by gcc.  In order to pass other options on to these processes the -W<letter> options must be used.

给subprocess传递参数


For bug reporting instructions, please see:
<file:///usr/share/doc/gcc-4.4/README.Bugs>.

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 支付宝充话费显示商家未发货怎么办 快递被买家签收后调包了怎么办 快递买家签收了东西坏了怎么办 快递没签收到买家评价了怎么办 快递买家签收后现在要退货怎么办 支付宝充话费充错对方关机怎么办 闲鱼同意退款了买家不退东西怎么办 被骗了说给存q币怎么办 方正说我的淘宝字体侵权怎么办 买家说收到衣服没有吊牌该怎么办 淘宝下完订单店主不发货怎么办 工商局不给查被告企业的信息怎么办 被职业打假人起诉到法院怎么办 京东购物如果换货不给你发货怎么办 淘宝上发的快递没有了怎么办 天猫购物半个月不发货怎么办 京东网同一产品购买多规格的怎么办 天猫商城购买的家具要退换货怎么办 亚马逊美国站会员日前没销量怎么办 淘宝买的鞋子把脚磨坏了怎么办 拼多多下单 没货 没法发货怎么办 闲鱼退货物流弄坏了卖家拒收怎么办 客户说物流太慢了 要退货怎么办 京东退货物流系统不更新怎么办 把货交给物流但是物流丢货了怎么办 货还在物流就申请退款怎么办 荣耀4x返回键不管用怎么办 华为手机关不了机也开不了机怎么办 荣耀畅玩5x手机密码忘了怎么办 华为短信验证码失败其他错误怎么办 红米3x手机卡顿反应慢怎么办 华为手机不停的自动重启怎么办 华为荣耀4x卡在开机界面怎么办 华为荣耀8青春版密码忘了怎么办 华为手机内存满了开不起来怎么办 华为荣耀畅玩平板2比较卡怎么办 红米4x太卡了怎么办 魅蓝e移动卡只有2g网络怎么办 联通关闭2g网络双卡手机怎么办 小米6x手机插耳机音量大怎么办 音量键和亮度键盘拆了怎么办