Problem Description
I am running the 32bit version of Ubuntu 10.10 and trying to cross compile to a 64 bit target. Based on my research, I have installed the g++-multilib package.
The program is a very simple hello world:
#include <iostream>
int main( int argc, char** argv )
{
std::cout << "hello world" << std::endl;
return 0;
}
Compile:
g++ -m64 main.cpp
Error:
In file included from main.cpp:1:
/usr/include/c++/4.4/iostream:39: fatal error: bits/c++config.h: No such file or directory
compilation terminated.
I have found a `c++config.h` file but they reside under the `i486-linux-gnu` and `i686-linux-gnu` directories in `/usr/include/c++/4.4/` There is not `c++config.h` in `/usr/include/c++/bits`.
Any ideas on what I am missing? Compiling without the `-m64` flag works fine (a.out is created and runs correctly).
**Edit** Thanks to the hint from @nightcracker, I did a little more investigation into the include structure on the 32 and 64 bit systems. I have added an [answer][1] below that "fixes" the problem temporarily but I think it will break on the next update. Basically, I am missing a directory called `/usr/include/c++/4.4/i686-linux-gnu/64` that should contain a subdirectory called `bits` that has the missing include file. Any idea what package should be taking care of this?
[1]: https://stackoverflow.com/questions/4643197/missing-include-bits-cconfig-h-when-cross-compiling-64-bit-program-on-32-bit/4643464#4643464
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?