gcc多个include目录的优先级

gcc默认include路径

1
2
`gcc -print-prog-name=cc1` -v
`g++ -print-prog-name=cc1` -v

优先级由大到小对应下表中的从上到下

1
2
3
4
5
命令行-I指定,前面的大于后面的
CPATH
CPLUS_INCLUDE_PATH	#只对c++文件起作用
C_INCLUDE_PATH		#只对c文件起作用,即C_INCLUDE_PATH和CPLUS_INCLUDE_PATH不会同时起作用
gcc默认include路径

refer to:
http://www.3scard.com/index.php?m=blog&f=view&id=42