Friday, December 13, 2013

Boost linking error and its solution in ROS

Error


/usr/bin/ld: note: 'boost::signals::connection::~connection()' is defined in DSO /usr/lib/libboost_signals.so.1.46.1 so try adding it to the linker command line
  /usr/lib/libboost_signals.so.1.46.1: could not read symbols: Invalid operation
  collect2: ld returned 1 exit status



Solution

# Put this line before the executable or library in your CMakeLists.txt
   rosbuild_add_boost_directories()
   # assuming that my_target is your executable
   rosbuild_add_executable(my_target my_srcs/my_target.cpp)
   # Put this line after the executable or library:
   rosbuild_link_boost(my_target signals)

If the above steps does not solve the issue then add
target_link_libraries(my_target libboost_system.so)

No comments:

Post a Comment