查看gcc/g++默认include路径

`gcc -print-prog-name=cc1plus` -v

`g++ -print-prog-name=cc1plus` -v


例如,CentOS 6.3 64bit 下,`g++ -print-prog-name=cc1plus` -v 的运行结果是:

ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include-fixed"

ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../x86_64-redhat-linux/include"

#include "..." search starts here:

#include <...> search starts here:

 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6

 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/x86_64-redhat-linux

 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/backward

 /usr/local/include

 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/include

 /usr/include

End of search list.

即,默认include路径是

 /usr/include/c++/4.4.6

 /usr/include/c++/4.4.6/x86_64-redhat-linux

 /usr/include/c++/4.4.6/backward

 /usr/local/include

 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/include

 /usr/include


`powerpc-linux-gcc -print-prog-name=cc1` -v    
ignoring nonexistent directory "/opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/powerpc-e300c3-linux-gnu/libc/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/include
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/include-fixed
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/../../../../powerpc-e300c3-linux-gnu/include
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/powerpc-e300c3-linux-gnu/libc/usr/include
End of search list.


`powerpc-linux-gcc -print-prog-name=cc1plus` -v
ignoring nonexistent directory "/opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/powerpc-e300c3-linux-gnu/libc/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/../../../../powerpc-e300c3-linux-gnu/include/c++/4.1.2
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/../../../../powerpc-e300c3-linux-gnu/include/c++/4.1.2/powerpc-e300c3-linux-gnu
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/../../../../powerpc-e300c3-linux-gnu/include/c++/4.1.2/backward
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/include
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/include-fixed
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/lib/gcc/powerpc-e300c3-linux-gnu/4.1.2/../../../../powerpc-e300c3-linux-gnu/include
 /opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/powerpc-e300c3-linux-gnu/libc/usr/include
End of search list.


你可能感兴趣的:(查看gcc/g++默认include路径)