C头文件调用路径:
export C_INCLUDE_PATH=/usr/local/include:$C_INCLUDE_PATH
#也可在gcc参数中指定调用路径
-I/usr/local/include
C++头文件调用路径:
export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH
动态库调用路径:
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
#也可在gcc参数中指定调用路径
-L/usr/local/lib
#指定调用库的名字,如libcurl.so
-lcurl
pkg-config路径:
export PKG_CONFIG_PATH=/usr/local/pkgconfig/
程序运行时动态库调用路径:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
#也可添加到全局动态库
echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf
ldconfig
查看gcc默认查找头文件/动态库目录:
`gcc -print-prog-name=cc1` -v
gcc -print-search-dirs
参考:http://www.cnblogs.com/vamei/archive/2013/04/04/2998850.html