0

This post: What is the default path for OSX system include files when building a C++ application? gives me a command I can run to see what my default g++ include path is:

echo "" | gcc - -xc -v -E

When I run this, among other things, I get my default include path:

#include <...> search starts here:
/Applications/gcc471/lib/gcc/x86_64-apple-darwin12.0.0/4.7.1/include
/usr/local/include
/Applications/gcc471/include
/Applications/gcc471/lib/gcc/x86_64-apple-darwin12.0.0/4.7.1/include-fixed
/usr/include
/System/Library/Frameworks
/Library/Frameworks

However, I have no idea how this path is constructed. How do I change the order of this default path? Note, this is not $PATH (I know how to do export $PATHs in my .profile). Checking /etc/paths led to a help file explaining how $PATH is actually constructed, but I want to know how this different include path (not sure if it has a system name like $INCLUDEPATH) is constructed, and how I can change its order.

4

1 回答 1

1

它有点内置; gccgcc -dumpspecs本文向您展示了如何更改所有这些内容,但是您不需要更改它,只需使用-I命令行选项添加即可:

例如:

$ gcc -I /path/to/my/fave/lib -c file.cpp

-I(您可以在同一命令行上使用多个标志)。

于 2013-10-23T05:21:21.733 回答