缺少包括“bits / c ++ config.h”当Ubuntu在32位上交叉编译64位程序时 [英] Missing include "bits/c++config.h" when cross compiling 64 bit program on 32 bit in Ubuntu

查看:2190
本文介绍了缺少包括“bits / c ++ config.h”当Ubuntu在32位上交叉编译64位程序时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Ubuntu 10.10的32位版本,并尝试将其交叉编译为64位目标。基于我的研究,我已经安装了g ++ - multilib软件包。



这个程序是一个非常简单的hello world:

  #include< iostream> 

int main(int argc,char ** argv)
{
std :: cout<< hello world<<的std :: ENDL;
返回0;

编译:

  g ++ -m64 main.cpp 

错误:

 在main.cpp包含的文件中:1:
/usr/include/c++/4.4/iostream:39:致命错误:bits / c ++ config.h:没有这样的文件或目录
编译终止。

我找到了一个 c ++ config.h 文件,但它们位于<$ c目录下的 i486-linux-gnu i686-linux-gnu 目录下$ c> / usr / include / c ++ / 4.4 / / usr中没有 c ++ config.h / include / c ++ / bits



关于我缺少的任何想法?没有 -m64 标志的编译工作正常(a.out被创建并正确运行)。

编辑感谢@nightcracker的提示,我对32位和64位系统上的include结构做了一些调查。我已经添加了回答下方的暂时解决问题,但我认为它会在下次更新时中断。基本上,我缺少一个名为 / usr / include / c ++ / 4.4 / i686-linux-gnu / 64 的目录,它应该包含一个名为位的子目录缺少包含文件。任何想法什么包应该照顾这个?

解决方案

添加这个答案部分是因为它解决了我的问题和所以我可以自己为此问题添加书签。



我可以通过执行以下操作来修复它:

  sudo apt-get install gcc-multilib g ++  -  multilib 

如果你已经安装了默认不发货的 gcc / g ++ 版本(例如 g ++ - 4.8 在lucid上)你需要匹配这个版本:

  sudo apt-get install gcc-4.8-multilib g ++  -  4.8-multilib 


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 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?

解决方案

Adding this answer partially because it fixed my problem of the same issue and so I can bookmark this question myself.

I was able to fix it by doing the following:

sudo apt-get install gcc-multilib g++-multilib

If you've installed a version of gcc / g++ that doesn't ship by default (such as g++-4.8 on lucid) you'll want to match the version as well:

sudo apt-get install gcc-4.8-multilib g++-4.8-multilib

这篇关于缺少包括“bits / c ++ config.h”当Ubuntu在32位上交叉编译64位程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆