August 23, 2011

gcc default include path

this is how to find out the default include path:

method 1:


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


method 2:

You can create a file that attempts to include a bogus system header. If you run gcc in verbose mode on such a source, it will list all the system include locations as it looks for the bogus header. $ echo "#include <bogus.h> int main(){}" > t.c; gcc -v t.c; rm t.c [..]
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-apple-darwin9/4.0.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
[..]
t.c:1:32: error: bogus.h: No such file or directory

No comments:

Post a Comment