紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
使用catkin_make编译时提示boost下的thread出错,请问要怎么解决
-
In file included from /usr/include/boost/thread/detail/platform.hpp:17, from /usr/include/boost/thread/mutex.hpp:12, from /opt/ros/noetic/include/ros/publisher.h:36, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/filter2move_frame_sum.cpp:1: /usr/include/boost/config/requires_threads.hpp:47:5: error: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" 47 | # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" | ^~~~~ In file included from /usr/include/boost/thread/mutex.hpp:12, from /opt/ros/noetic/include/ros/publisher.h:36, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/filter2move_frame_sum.cpp:1: /usr/include/boost/thread/detail/platform.hpp:71:9: error: #error "Sorry, no boost threads are available for this platform." 71 | # error "Sorry, no boost threads are available for this platform." | ^~~~~ In file included from /opt/ros/noetic/include/ros/publisher.h:36, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/filter2move_frame_sum.cpp:1: /usr/include/boost/thread/mutex.hpp:18:2: error: #error "Boost threads unavailable on this platform" 18 | #error "Boost threads unavailable on this platform" | ^~~~~ In file included from /usr/include/boost/thread/detail/platform.hpp:17, from /usr/include/boost/thread/mutex.hpp:12, from /opt/ros/noetic/include/ros/publisher.h:36, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/detach_box.cpp:1: /usr/include/boost/config/requires_threads.hpp:47:5: error: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" 47 | # error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)" | ^~~~~ In file included from /usr/include/boost/thread/mutex.hpp:12, from /opt/ros/noetic/include/ros/publisher.h:36, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/detach_box.cpp:1: /usr/include/boost/thread/detail/platform.hpp:71:9: error: #error "Sorry, no boost threads are available for this platform." 71 | # error "Sorry, no boost threads are available for this platform." | ^~~~~ In file included from /opt/ros/noetic/include/ros/publisher.h:36, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/detach_box.cpp:1: /usr/include/boost/thread/mutex.hpp:18:2: error: #error "Boost threads unavailable on this platform" 18 | #error "Boost threads unavailable on this platform" | ^~~~~ In file included from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/detach_box.cpp:1: /opt/ros/noetic/include/ros/publisher.h:204:14: error: ‘mutex’ in namespace ‘boost’ does not name a type 204 | boost::mutex last_message_mutex_; | ^~~~~ In file included from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/chestnutl/xiaoche_ws/src/opencv_object_tracking/src/filter2move_frame_sum.cpp:1: /opt/ros/noetic/include/ros/publisher.h:204:14: error: ‘mutex’ in namespace ‘boost’ does not name a type 204 | boost::mutex last_message_mutex_; | ^~~~~ make[2]: *** [opencv_object_tracking/CMakeFiles/detach_box.dir/build.make:63:opencv_object_tracking/CMakeFiles/detach_box.dir/src/detach_box.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:2959:opencv_object_tracking/CMakeFiles/detach_box.dir/all] 错误 2 make[1]: *** 正在等待未完成的任务.... make[2]: *** [opencv_object_tracking/CMakeFiles/filter2move_frame_sum.dir/build.make:63:opencv_object_tracking/CMakeFiles/filter2move_frame_sum.dir/src/filter2move_frame_sum.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:2480:opencv_object_tracking/CMakeFiles/filter2move_frame_sum.dir/all] 错误 2 make: *** [Makefile:141:all] 错误 2 Invoking "make -j8 -l8" failed
-
@chestnutl 应该没有开启boost库里的线程组件
@chestnutl 在 使用catkin_make编译时提示boost下的thread出错,请问要怎么解决 中说:
Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris)
-
@小鱼 嗯嗯,请问应当如何解决呢
-
@小鱼 快查了两天了,都没找到怎么解决这个,麻了
-
@chestnutl 这个要看你工程了,具体需要添加类似于下面的内容
## System dependencies are found with CMake's conventions find_package(Boost REQUIRED COMPONENTS thread ) if(NOT Boost_FOUND) message("NOT found Boost") endif() include_directories(${Boost_INCLUDE_DIRS}) # Declare the executable target built from your sources add_executable(${PROJECT_NAME} src/test_main.cpp) target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
-
@小鱼 哦哦,但是我之前编译同一个工作空间的时候没加这个也能编译成功啊
-
@chestnutl 同一个工作空间catkin用的同一个cmake,把依赖放一起了,具体你可能需要学习下catkin编译的原理和流程。
-
@小鱼 哦哦,好的。感谢
-
@小鱼 我在功能包的cmakelist内加了上面这一段编译也不通过啊
-
@chestnutl 具体情况具体分析,我只能跟你说个大概方向 ,代码怎么写的、工程什么结构、系统什么版本,具体的调试起来才能解决,这些需要你自己去做的。
-
@小鱼 哦哦,好的