本文介绍了-m32选项不能与gcc一起使用,但适用于g ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在x86_64 ubuntu 12.04机器上编译32位目标的应用程序。
我使用
I was trying to compile an application for 32 bit target on x86_64 ubuntu 12.04 machine.I installed the required packages using
sudo apt-get install gcc-multilib g++-multilib libc6-i386 libc6-dev-i386
第一个命令生成32位版本。但是,第二个命令错误输出
The first command works generating the 32 bit version. However, the second command errors out
1. g++ -m32 hello.c
2. gcc -m32 hello.c
skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
我为什么gcc无法工作。我缺少一些库吗?
Could anyone explain to me why gcc fails to work. Am I missing some libraries?
谢谢!
推荐答案
我将我的g ++升级到4.8和g ++ -m32停止工作了。安装g ++ - 4.8-multilib使-m32选项与gcc和g ++一起工作。
I upgraded my g++ to 4.8 and g++ -m32 stopped working too. Installing g++-4.8-multilib made -m32 option work with both gcc and g++.
这篇关于-m32选项不能与gcc一起使用,但适用于g ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!