The boost::thread library is one of the boost libraries that is not contained only in header-files. Some of the boost::thread code also resides in binary library files that are installed on the system with the rest of the boost installation.
The error message you're getting indicates that the linker is unable to find the implementation code for the disable_interruption() method. It's probably located in the binary boost::thread library file, so you'll need to tell the linker to also link this library in with the rest of your project.
For ROS, this linking is typically configured in the package's CMakeLists.txt
file. The exact call you'll use is different depending on whether you're using rosbuild or catkin:
- For rosbuild, you can add
rosbuild_link_boost(my_exe thread)
- For catkin, you can add
find_package(Boost REQUIRED COMPONENTS thread)
followed by target_link_libraries(my_exe ${Boost_LIBRARIES})
If you're able to build your package from the command line, but are only having problems within Eclipse, then the problem may be related to your Eclipse configuration. See here for the recommended steps to configure and run Eclipse with ROS.
Edit: fix reference to ${Boost_LIBRARIES}
, thanks to @"Dirk Thomas"