未定义对`boost::thread的引用
undefined reference to `boost::thread
我正在尝试将libgetfiles.so链接到main.cpp。我运行了以下命令:
sudo g++ main.cpp -L/ubuntu/test -lgetfiles -L/usr/local/lib/ -lboost_thread
它给了我以下错误:
/ubuntu/test/libgetfiles.so: undefined reference to'boost::thread::start_thread_noexcept()'
/ubuntu/test/libgetfiles.so: undefined reference to 'boost::thread::join_noexcept()'
/ubuntu/test/libgetfiles.so: undefined reference to 'boost::system::system_category()'
/ubuntu/test/libgetfiles.so: undefined reference to 'boost::system::generic_category()'
我该如何解决这些问题?
我也尝试过卸载和重新安装提升库。我还尝试了以下命令:
g++ main.cpp -L/ubuntu/test -lgetfiles -L/usr/local/lib/ -lboost_thread-mt
他们两个都不适合我。
如果手动构建并安装boost(即特定版本),则应检查/usr/lib中是否已安装libboost all-dev包。尝试rm /usr/lib/libboost* && rm -r /usr/include/boost
,然后重新构建。
- 将对象数组的引用传递给函数
- 什么时候在C++中返回常量引用是个好主意
- 对 'std::thread::_M_start_thread CMake 的未定义引用进行基准测试
- std::thread 增加 DLL 引用计数,从而防止卸载 DLL
- 为什么我们不允许将纯引用参数传递给 std::thread,但允许传递原始指针?
- 如果容器不是调用函数中的引用,则使用 std::thread 传递对迭代器的引用将失败
- 创建RSA_PrivateKey时对"std::thread::_State::~_State()"的未定义引用
- 将回调函数中对对象的引用传递给 std::thread
- 将基类的引用传递给 boost::thread 并在派生类中调用虚函数是否有效
- 错误 C2280:'std::thread::thread(const std::thread &)':尝试引用已删除的函数
- 在 Ubuntu 14.04 上使用 boost 编译:未定义对 'boost::thread::get_id() const' 的引用
- 我可以将数组每次移动引用传递给 std::thread 吗?
- 如何创建带有引用的函数指针的 std::thread
- std::thread constructor传递指针和通过引用传递有区别吗
- 未定义对在mingw64上使用boost.thread的InterlockedCompareExchange的引用(但不
- 通过引用C++11中的std::thread来传递对象
- 为什么我不能使用 std::thread 通过引用发送对象
- 未定义对`boost::thread的引用
- 为什么std::thread通过转发引用接受一个函子
- 获取对 std::thread::_M_start_thread 的未定义引用