【发布时间】:2012-07-08 09:09:17
【问题描述】:
我有一个问题:我使用 Boost (locks.hpp) 编写了代码。我的服务器正在运行 x64 Ubuntu (Linux)。当我用-m64 编译这段代码时,它构建得很好。但是当我尝试为-m32 编译时,我得到了这些错误:
g++ -fPIC -m32 -shared -Wl,-soname,test.so -ldl -o test.so test.cpp -lboost_thread
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libboost_thread.so when searching for -lboost_thread
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../libboost_thread.a when searching for -lboost_thread
/usr/bin/ld: skipping incompatible //usr/lib/libboost_thread.so when searching for -lboost_thread
/usr/bin/ld: skipping incompatible //usr/lib/libboost_thread.a when searching for -lboost_thread
/usr/bin/ld: cannot find -lboost_thread
collect2: ld returned 1 exit status
我做错了什么?谢谢!
【问题讨论】:
-
虽然我没有使用 G++ 的经验:您是否可能没有 32 位版本的 boost(有点像我如何解释“不兼容的东西”)...
-
您确定安装了 32 位 boost 库吗?
-
@fvu 你能给我一个在 x64 ubuntu 上安装 32 位 boost 库的命令吗?
-
@Robert 不抱歉,当我读到这个askubuntu.com/questions/29665/… 时,它看起来肯定比在我使用的opensuse 上要难得多...
标签: c++ boost g++ linker-errors