Include paths for cpp/g++ (gcc 4.3.0)

Jonas Karlsson
Sun Sep 7 18:09:00 GMT 2008

2008/5/6 Tim Prince <>:
> Jonas Karlsson wrote:
>> I have problem building cpp with my installation of gcc 4.3.0, which I
>> built from
>> source. The specific problem in this case is that it can't find the system
>> wctype.h, but I don't know if it applies to other system header files.
>> This is using GoboLinux, so paths may differ from "normal" systems, but
>> files
>> should be available where expected.
>> Header files is found in /System/Links/Headers (as symbolic links) and
>> wctype.h (the file g++ can't find) is located there:
>> $ls -l /System/Links/Headers/wctype.h
>> $cat something.cpp
>> #include <cwctype>
>> In file included from something.cpp:1:
>> /Programs/GCC/Current/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/cwctype:51:25:
>> error: wctype.h: No such file or directory
> You're telling g++ to look for header files only in its own system include
> paths.  It's set up this way to allow multiple compilers to coexist.  If you
> have headers which work with g++, put them in the paths where you have
> configured your g++ to search for them.
As I got a question off-list as to if I got this issue solved. So mail
this is to add the solution to the archives.
The reason for the issue was a combination of CPLUS_INCLUDE_PATH, g++
removing search paths and the new "#include_next wctype.h" (instead of
just "#include wctype.h" earlier).

g++ adds paths in CPLUS_INCLUDE_PATH before any of the built in search
paths. That, in combination of g++ removing duplicate paths resulted
in the path with the c headers was the first path in the search path
list. When the c++ header was found in a later path, the macro was
"include_next" and no c header paths were left in the list the c
header could not be found which resulted in the above error. With
earlier releases of GCC the macro was just "#include wctype.h", which
worked fine with CPLUS_INCLUDE_PATH set to something that evicted
later c include paths.

Hope that makes some sense and thanks for the help.


More information about the Gcc-help mailing list