wiessharling

一、看例子分析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静态库文件)

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2021-12-12
  • 2021-12-22
  • 2021-12-22
  • 2021-11-28
  • 2021-11-28
猜你喜欢
  • 2021-12-22
  • 2021-12-22
  • 2021-11-28
相关资源
相似解决方案