码迷,mamicode.com
首页 > 其他好文 > 详细

GCC编译选项

时间:2014-09-29 15:49:21      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   strong   文件   sp   div   art   

一、看例子分析gcc 的编译选项

gcc -o hello hello.c -I /home/hello/include -L /home/hello/lib -lworld

 

1.-I /home/hello/include    将/home/hello/include目录作为第一个寻找头文件的目录,寻找的顺序是:/home/hello/include-->/usr/include-->/usr/local/include

2. -L /home/hello/lib        将/home/hello/lib目录作为第一个寻找库文件的目录,寻找的顺序是:/home/hello/lib-->/lib-->/usr/lib-->/usr/local/lib

3.  -lworld                        在上面的lib的路径中寻找libworld.so动态库文件(如果gcc编译选项中加入了“-static”表示寻找libworld.a静态库文件)

GCC编译选项

标签:style   blog   color   ar   strong   文件   sp   div   art   

原文地址:http://www.cnblogs.com/wiessharling/p/4000110.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!