我正在尝试将 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/