关于gcc编译 -I -L -l的使用说明

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

参数说明:

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

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

  • -lworld表示在上面的lib的路径中寻找libworld.so动态库文件

发布了88 篇原创文章 · 获赞 16 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/WHEgqing/article/details/104924605
l