链接到boost ::线程失败
link to boost::thread fails
我正在尝试安装一个名为MGIZA的程序。它用CMAKE编译,需要一些提升库。我使用了命令
cmake .
make
当我运行'make'时,我会收到以下错误:
d4norm.cxx:(.text+0x95b): undefined reference to `boost::system::generic_category()'
和赞。我在cmakelists.txt中插入以下行:
FIND_PACKAGE( Boost 1.41 COMPONENTS system)
它起作用是因为可以编译更多文件,并且上面的警告消失了,但我收到了另一个警告:
main.cpp:(.text+0x7174): undefined reference to `boost::thread::hardware_concurrency()'
尽管我已经在cmakelists中有Find_package(Boost 1.41组件线程)。我在做什么错?
您还需要搜索线程组件:
find_package(Boost 1.41 COMPONENTS thread system)
在boost的较新版本中,您还应针对boost.chrono
链接find_package(Boost COMPONENTS thread chrono system)
然后,您还需要将可执行文件链接起来,并添加包含:
# Check if everything worked out
if(Boost_FOUND)
add_executable(main main.cpp) # your executable or library or whatever
target_link_libraries(main ${Boost_LIBRARIES})
target_include_directories(main ${Boost_INCLUDE_DIRS})
else()
# panic
endif()
相关文章:
- 非静态成员失败的线程调用函数
- MS 本机单元测试 - 断言::线程失败不起作用
- 两个线程一个使用流 Api,另一个线程创建文件失败并出现错误ERROR_SHARING_VIOLATION
- 使用提升线程时编译失败
- librdkafka 线程在失败时不清理
- 错误:静态断言失败:std ::线程参数必须在转换为rvalues后不可行
- 什么时候标准::线程::连接会因no_such_process而失败
- 更改线程实时调度策略失败:config_rt_group_sched = y
- C++ 提升 UDP 接收器在放入线程时失败
- 为线程构造函数传递引用以将其绑定到函数失败
- glewInit 从后台线程调用时失败
- 链接到boost ::线程失败
- 将函子传递给boost ::线程在Visual Studio 2010中失败
- Qt 窗口包含提升线程标头失败
- 在多个线程中使用libcurl失败
- pthread_create()在Xeon Phi上每60个线程失败一次(参数无效)
- Boost线程失败Boost_ASSERT(px!=0);
- 当一个工作线程失败时,如何中止剩余的工作线程
- 一段时间后使线程失败
- Pthread_create创建多个线程失败