ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

How to solve 'undefined reference to symbol 'vtable for boost::detail::thread_data_base' ?

asked 2012-06-29 20:57:16 -0500

li-an gravatar image

updated 2012-07-01 10:47:50 -0500

Eric Perko gravatar image

follow:Moving the gripper

 Linking CXX executable ../bin/simple_gripper
/usr/bin/ld: CMakeFiles/simple_gripper.dir/src/lian_gripper.o: undefined reference to symbol 'vtable for boost::detail::thread_data_base'
/usr/bin/ld: note: 'vtable for boost::detail::thread_data_base' is defined in DSO /usr/lib/libboost_thread.so.1.46.1 so try adding it to the linker command line
/usr/lib/libboost_thread.so.1.46.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[3]: *** [../bin/simple_gripper] Error 1

How to solve it ? Thank you !!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
10

answered 2012-06-30 04:04:38 -0500

mjcarroll gravatar image

This typically indicates that you haven't set up you CMakeLists.txt correctly.

You are missing the Boost-related directives, try adding rosbuild_add_boost_directories() and rosbuild_link_boost() to your CMakeLists.txt

It should look something like this:

cmake_minimum_version(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake

rosbuild_init()
rosbuild_add_boost_directories()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) 

rosbuild_add_executable(simple_gripper src/simple_gripper.cpp)
rosbuild_link_boost(simple_gripper thread)

For more information on using the CMakeLists.txt file, check out the rosbuild wiki page.

There are also some good examples on the examples page.

edit flag offensive delete link more

Comments

Several of my classmates and I all had problems with the tutorial and were able to solve them by adding the boost-related directories. This should be added to the tutorial documentation.

timdixon777 gravatar image timdixon777  ( 2013-03-22 12:56:07 -0500 )edit

Question Tools

Stats

Asked: 2012-06-29 20:57:16 -0500

Seen: 3,651 times

Last updated: Jun 30 '12