gpt4 book ai didi

c++ - 对 Boost 线程的 undefined reference

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:40:09 25 4
gpt4 key购买 nike

我正在尝试编译和使用 Boost 1.54 库,但遇到了死胡同。

我编译并安装了文档中提到的库:

./bootstrap.sh
./b2 install

我什至尝试使用以下方法完全重新安装:

./bootstrap.sh
./b2 threading=multi install

我已经使用 -lboost_thread-L*path 链接到 boost*/bin.v2/libs

我仍然收到以下链接器错误:

undefined reference to boost::thread::start_thread_noexcept()
undefined reference to boost::thread::join_noexcept()

我在 Eclipse 中的 Ubuntu 12.04 上使用 gcc 4.6.3。

有谁知道我该如何解决这个问题?

最佳答案

在对 ubuntu 存储库的默认 boost 造成相当大的痛苦之后,我使用默认选项安装了 boost 1.54.0(来自官方网页),以下对我有用:

g++ test.cpp -o test -L/usr/local/lib/ -lboost_thread

附言:在 Ubuntu 12.04 上,gcc 4.63

P.S2:包含在我的test.cpp中的是:

#include "boost/thread/thread.hpp"
#include "boost/bind.hpp"

关于c++ - 对 Boost 线程的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17455928/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com