如何查看include路径有那些:
shell> <strong>cpp -v</strong>
Using built-in specs.
COLLECT_GCC=cpp
...
#include "..." search starts here:
#include <...> search starts here:
<span style="color:#FF0000;"><strong>/usr/lib/gcc/i686-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/4.8/include-fixed
/usr/include/i386-linux-gnu
/usr/include</strong></span>
End of search list.
利用系统的环境变量。
对于头文件的搜索路径:
C_INCLUDE_PATH=<your include path>;
export C_INCLUDE_PATH
对于库文件的搜索路径:
LIBRARY_PATH=<your lib path>;
export LIBRARY_PATH
对于链接程序ld使用的库文件搜索路径:
LD_LIBRARY_PATH=<your ldlib path>;
export LD_LIBRARY_PATH
使用 -I -l等编译参数