Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

GCC has built in include directories for certain standard headers. I just need to know where this list is. My newly compiled gcc will not compile my little test C++ program because it cannot find standard headers. I think it fails because of some config options I used to make my file system more organized. I set the bindir and libdir, which I think might have screwed up the built-in include paths for some reason.

Program (dummy.c):

#include <iostream>
void main(){}


g++ dummy.c


dummy.c:1:20: fatal error: iostream: No such file or directory
share|improve this question
up vote 4 down vote accepted

The preprocessor can tell you what it uses

cpp -x c++ -v


    #include "..." search starts here:
    #include <...> search starts here:
    End of search list.

You can add directories to the search path by setting the C_INCLUDE_PATH and/or CPLUS_INCLUDE_PATH environment variiables

share|improve this answer
ah great, I was looking for some way to actually print those out. Now I know for certain that they are screwed up. – Charles Jun 2 '10 at 21:09
It appears that later versions of gcc don't have a default specs file to read from, but can generate one for later customisation. There is more discussion about this here – Iain Jun 3 '10 at 9:02
I made some customizations to my specs file to add the real include directories and I can now compile. Usually I would not let such a hack fly but this is a temp toolchain anyway, thanks! – Charles Jun 3 '10 at 13:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.