gcc编译之路径搜索
头文件
--> 搜寻先从-I开始;
--> 找gcc的环境变量 : C_INCLUDE_PATH,CPLUS_INCLUDE_PATH,OBJC_INCLUDE_PATH
--> 内定目录:
/usr/include
/usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95./include
/usr/lib/gcc-lib/i386-linux/2.95./include/g++-
/usr/lib/gcc-lib/i386-linux/2.95./i386-linux/include
如果安装gcc给定了prefix,那么就寻找目录:
/usr/include
prefix/include
prefix/xxx-xxx-xxx-gnulibc/include
prefix/lib/gcc-lib/xxxx-xxx-xxx-gnulibc/2.8./include
库文件
--> 搜寻从-L开始
--> 找gcc的环境变量LIBRARY_PATH
--> 找内定目录
/lib:/usr/lib: /usr/local/lib:
运行动态库搜索路径
-->编译目标代码时指定的动态库搜索路径(通过gcc的参数"-Wl,-rpath,"指定。多个动态库搜索路径之间用冒号":"分隔);
-->环境变量LD_LIBRARY_PATH指定的动态库搜索路径;
-->配置文件/etc/ld.so.conf中指定的动态库搜索路径;
-->默认的动态库搜索路径/lib /usr/lib。