Find the answer to your Linux question:
Results 1 to 2 of 2
C++ users, I am having some pretty basic problems with either my C++ libraries or C++ compilers. I first noticed the problem when I was trying to compile MPICH2, so ...
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    15

    c++ Errors

    C++ users,

    I am having some pretty basic problems with either my C++ libraries or C++ compilers. I first noticed the problem when I was trying to compile MPICH2, so I went back and tried to compile a very simple "Hello World!" program:

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
            cout << "Hello World!" << endl;
            return 0;
    }

    But when I try compile this with the intel C++ compiler ("icc test.c++) I get this:


    Code:
    /usr/include/c++/3.4.6/iostream(44): catastrophic error: could not open source file "bits/c++config.h"
      #include <bits/c++config.h>
                                 ^
    
    compilation aborted for test.c++ (code 4)


    Also I only get this error on the head node of our 20 node cluster. So if I ssh to any other node this program compiles just fine. When I try to compile with g++ (g++ test.c++) I get a whole mess of errors, most of it looks like this though:

    Code:
    In file included from test.c++:1:
    /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/iostream:44:28: bits/c++config.h: No such file or directory
    In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ios:44,
                     from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ostream:45,
                     from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/iostream:45,
                     from test.c++:1:
    /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/iosfwd:46:29: bits/c++locale.h: No such file or directory
    /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/iosfwd:47:25: bits/c++io.h: No such file or directory
    In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ios:46,
                     from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ostream:45,
                     from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/iostream:45,
                     from test.c++:1:


    Any suggestions on what might be the problem here. I thank you in advance for your help!

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    It looks to me that you haven't installed your compiler correctly: you appear to be missing some files from the C++ standard library.

    It looks like you're using either Red Hat or Fedora Core, so I'd suggest checking the documentation for your distribution and double-checking the steps to install the C++ compiler.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...