c++ - 对 `boost::thread 的 undefined reference

标签 c++ linux ubuntu boost

我正在尝试将 libgetfiles.so 链接到 main.cpp。我运行了以下命令:

sudo g++ main.cpp -L/ubuntu/test -lgetfiles -L/usr/local/lib/-lboost_thread

它给我以下错误:

/ubuntu/test/libgetfiles.so:未定义对“boost::thread::start_thread_noexcept()”的引用 /ubuntu/test/libgetfiles.so:未定义对“boost::thread::join_noexcept()”的引用 /ubuntu/test/libgetfiles.so:未定义对“boost::system::system_category()”的引用 /ubuntu/test/libgetfiles.so:对“boost::system::generic_category()”的 undefined reference

我该如何解决它们?

我也尝试过卸载和重新安装 boost 库。 我也试过下面的命令:

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++ - 对 `boost::thread 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33800677/

相关文章:

linux - 如何 : Using syslog for user created shell script

c++ - Linux 中的 C++ 编程资源

ubuntu - 在 ubuntu 16 上安装 Octave 软件包

linux - IPC - 如何将命令输出重定向到子进程中的共享内存段

c - 如何为 VyOS 内核编写补丁

mysqlshow 中缺少 mySQL 数据库

c++ - 为什么 GLM 构造函数都是显式的?

c++ - 使用 uncrustify 在 if-else block 后添加换行符

c++ - 统计一个函数在一段时间内被调用了多少次

c++ - 带有 "endl"的模板函数的 VS2015 编译错误