程序是比较早写的 05年左右 现在想重新做 自己新装了UBUNTU 12.04 64-BITS
但程序是32位的 并且分许多段 有C 和C++
一开始当然是编译不成功啦,
后来安装了:apt-get install ia32-libs libc6-dev-i386 linux32
然后在GCC参数中加入:-m32
终于GCC编译成功:
$ gcc -m32 hellow_world.cpp
$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x5689cfc45e93114d4a66374b5e4be93af046bf9f, not stripped
但是在第二段程序中(C++编写)
在g++后面加入-m32也没有用。写一个小的hellow world.cpp
然后用g++ -m32 hellow_world.cpp编译 也有问题。问题如下:
$ g++ -m32 hellow_world.cpp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
求大神解救~~~
P.S 请别出重新安装32位操作系统的主意啊。。。拜托各位~~~
