fatal error: 'bits/c++config.h' file not found

Hi :

I am getting the follwing error when I compile a simple C++ program.

fatal error: 'bits/c++config.h' file not found

I am using RedHat system. I tried to find the c++config file but
could not find it it. I checked the /usr/include/c++/4.4.0/bits path.

Probably not the right set of include paths in the binary. Which version of Red Hat Linux are you using and what gcc/g++ and libstdc++ do you have installed?

-eric

Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)

I am linking gcc-4.4.0 and not the gcc version 4.1.2

You're likely to be missing machine dependent includes.

This is how I call clang++ on OpenBSD with libestdc++:

-I/usr/local/include/c++/4.2.4
-I/usr/local/include/c++/4.2.4/i386-unknown-openbsd4.8
-I/usr/local/include/c++/4.2.4/backward
-L/usr/lib/gcc-lib/i386-unknown-openbsd4.7/4.2.1
-L/usr/local/lib

I don't know what you mean by linking in this context, but I'm guessing you're on Fedora 8 or some similar. It should be able to find the include files. Can you try something simple like hello world and use the -v option to clang to see what paths it's searching?

-eric

Here is the complete information

./install/bin/clang++ -v -IDPC++-headers -nostdinc++
-I/usr/include/c++/4.4.0/ ./test2.cpp
clang version 2.8 (trunk 111936)
Target: x86_64-unknown-linux-gnu
Thread model: posix
"/home/cs/wei/install/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name test2.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.17.50.0.6
-v -nostdinc++ -resource-dir /home/cs/wei/install/lib/clang/2.8 -I
DPC++-headers -I /usr/include/c++/4.4.0/ -ferror-limit 19
-fmessage-length 80 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-hpIFFi.s -x
c++ ./test2.cpp
clang -cc1 version 2.8 based upon llvm 2.8svn hosted on x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
DPC++-headers
/usr/include/c++/4.4.0
/usr/local/include
/home/cs/wei/install/lib/clang/2.8/include
/usr/include
End of search list.
In file included from ./test2.cpp:1:
/usr/include/c++/4.4.0/iostream:38:10: fatal error: 'bits/c++config.h' file not
      found
#include <bits/c++config.h>
         ^
clang: /home/cs/wei/llvm/tools/clang/lib/Parse/../../include/clang/Lex/Token.h:181:
void clang::Token::setAnnotationValue(void*): Assertion
`isAnnotation() && "Used AnnotVal on non-annotation token"' failed.
0 clang 0x0000000001fb65c6
1 clang 0x0000000001fb6b54
2 libpthread.so.0 0x0000003c0f20eb10
3 libc.so.6 0x0000003c0e630265 gsignal + 53
4 libc.so.6 0x0000003c0e631d10 abort + 272
5 libc.so.6 0x0000003c0e6296e6 __assert_fail + 246
6 clang 0x0000000001128969
clang::Token::setAnnotationValue(void*) + 77
7 clang 0x0000000001123019
clang::Parser::TryAnnotateCXXScopeToken(bool) + 345
8 clang 0x000000000112f5bf
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 2741
9 clang 0x000000000113958b
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject*) + 1545
10 clang 0x000000000113a4ff
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
unsigned int, clang::Decl*) + 1305
11 clang 0x000000000113bba9
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
bool) + 5147
12 clang 0x0000000001130427
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 6429
13 clang 0x0000000001124266
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AttributeList*, clang::AccessSpecifier) + 120
14 clang 0x0000000001124699
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::AttributeList*,
clang::AccessSpecifier) + 83
15 clang 0x0000000001126350
clang::Parser::ParseExternalDeclaration(clang::CXX0XAttributeList,
clang::Parser::ParsingDeclSpec*) + 1512
16 clang 0x00000000011264ad
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
+ 263
17 clang 0x000000000110f9bd clang::ParseAST(clang::Sema&, bool) + 279
18 clang 0x0000000000ed3808
clang::ASTFrontendAction::ExecuteAction() + 234
19 clang 0x0000000000fd98c1
clang::CodeGenAction::ExecuteAction() + 851
20 clang 0x0000000000ed3910 clang::FrontendAction::Execute() + 256
21 clang 0x0000000000ebf70a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 660
22 clang 0x0000000000e78570
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 756
23 clang 0x0000000000e6c2d2 cc1_main(char const**, char
const**, char const*, void*) + 836
24 clang 0x0000000000e74940 main + 434
25 libc.so.6 0x0000003c0e61d994 __libc_start_main + 244
26 clang 0x0000000000e6bad9
Stack dump:
0. Program arguments: /home/cs/wei/install/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -main-file-name test2.cpp
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.17.50.0.6
-v -nostdinc++ -resource-dir /home/cs/wei/install/lib/clang/2.8 -I
DPC++-headers -I /usr/include/c++/4.4.0/ -ferror-limit 19
-fmessage-length 80 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-hpIFFi.s -x
c++ ./test2.cpp
1. /usr/include/c++/4.4.0/bits/ios_base.h:416:18: current parser token
'streampos'
2. /usr/include/c++/4.4.0/bits/ios_base.h:206:3: parsing
struct/union/class body 'ios_base'
clang: error: clang frontend command failed due to signal 6 (u

Here is test2.cpp

.----------------------------
#include <iostream>

using namespace std;

int main(void){

        cout << " Hello " << endl;
        return 1;

}

Well, it's looking where you told it so if the file isn't there then you need to figure out what you did.

-nostdinc++

is telling it not to look in the standard places it knows about.

-eric