GNU/Linux编程指南学习笔记之一:gcc

     gcc gives the programmers extensive control over the compilation process. The compilation process includes up to four stages:

Preprocessing(预处理)---------->Compilation Proper(彻底编译)-------->Assembly(汇编)--------->Linking(链接)

 

 

 

    gcc编译的一些主要参数:

    eg.  gcc hello.c -o hello

    1 、gcc -E hello.c -o hello.cpp   -E 预处理,即将头文件包含进来。

    2、 gcc -x cpp-output -c hello.cpp -o hello.o

                 -x 编译预处理之后的文件,生成目标文件(.o)。

    3、 -g 生成用于gdb调试的调试信息。

    4、 -ansi   Support the ANSI/ISO C standard, turning off GNU extensions that conflict with the standard(this option does not tuarantee ANSI-compliant code).

    5、 -pedantic   Emit all warnings required by the ANSI/ISO C standard.

    6 、 -pedantic-errors   Emit all errors required by the ANSI/ISO C standard.

 

 

 

     Library and Include File:

    如果有库或者头文件没有在标准的包含路径内, -L{DIRNAME} and -I{DIRNAME} option allow you to specify these locations and to insure that they are searched before the standard locations.

 

    假如你有包含文件在路径/usr/local/include/killerapp目录下,要使gcc包含它,可以用如下命令:

    eg.  $gcc someapp.c  -I/usr/local/include/killerapp

 

    包含库(.lib)

    $gcc myapp.c -L/home/fred/lib  -I/home/fred/include -lnew

 

 

    初学,一些讲的比较详细但不是基本应用的没有去深入研习,以后用到的时候回来翻看。

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值