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

Undefined Reference to boost

asked 2013-03-31 21:30:18 -0600

ROS_NOOB_CYBORG gravatar image

updated 2014-01-28 17:15:59 -0600

ngrennan gravatar image

Hi guys, I've been getting this error lately every time I compile my ethzasl_sensor_fusion.

The error I received is below:

Linking CXX executable ../bin/pose_sensor CMakeFiles/pose_sensor.dir/src/main.o: In function __static_initialization_and_destruction_0': /usr/local/include/boost/system/error_code.hpp:214: undefined reference toboost::system::generic_category()' /usr/local/include/boost/system/error_code.hpp:215: undefined reference to boost::system::generic_category()' /usr/local/include/boost/system/error_code.hpp:216: undefined reference toboost::system::system_category()' CMakeFiles/pose_sensor.dir/src/pose_sensor.o: In function __static_initialization_and_destruction_0': /usr/local/include/boost/system/error_code.hpp:214: undefined reference toboost::system::generic_category()' /usr/local/include/boost/system/error_code.hpp:215: undefined reference to boost::system::generic_category()' /usr/local/include/boost/system/error_code.hpp:216: undefined reference toboost::system::system_category()' collect2: ld returned 1 exit status make[3]: * [../bin/pose_sensor] Error 1 make[3]: Leaving directory /home/fyp4211/ROS_Pack/ethzasl_sensor_fusion/ssf_updates/build' make[2]: *** [CMakeFiles/pose_sensor.dir/all] Error 2 make[2]: Leaving directory/home/fyp4211/ROS_Pack/ethzasl_sensor_fusion/ssf_updates/build' make[1]: * [all] Error 2 make[1]: Leaving directory `/home/fyp4211/ROS_Pack/ethzasl_sensor_fusion/ssf_updates/build' -------------------------------------------------------------------------------} [ rosmake ] Output from build of package ssf_updates written to: [ rosmake ] /home/fyp4211/.ros/rosmake/rosmake_output-20130401-152352/ssf_updates/build_output.log

The cmake file is shown below:

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

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
#gencfg()
rosbuild_genmsg()

add_definitions (-Wall)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# get eigen
find_package(Eigen REQUIRED)
include_directories(${Eigen_INCLUDE_DIRS})

rosbuild_add_boost_directories()
rosbuild_add_executable(pose_sensor src/main.cpp src/pose_sensor.cpp)
rosbuild_link_boost(pose_sensor filesystem system)
set_property(TARGET pose_sensor PROPERTY COMPILE_DEFINITIONS POSE_MEAS)
rosbuild_add_compile_flags(pose_sensor "-O3")
target_link_libraries(pose_sensor ssf_core)

rosbuild_add_boost_directories()
rosbuild_add_executable(position_sensor src/main.cpp src/position_sensor.cpp)
rosbuild_link_boost(position_sensor filesystem system)
set_property(TARGET position_sensor PROPERTY COMPILE_DEFINITIONS POSITION_MEAS)
rosbuild_add_compile_flags(position_sensor "-O3")
target_link_libraries(position_sensor ssf_core)

Can you guys help me out with this problem. Thanks!!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-04-01 23:54:26 -0600

Add following line to your cmake

rosbuild_link_boost(pose_sensor system)

sorry I deleted my previous answer+ your comment while I was going to edit it.

edit flag offensive delete link more

Comments

Yeah..So what I did is put that line after rosbuild_add_executable(pose_sensor src/main.cpp src/pose_sensor.cpp). And..the results is the same. Any other idea..Thanks!

ROS_NOOB_CYBORG gravatar image ROS_NOOB_CYBORG  ( 2013-04-02 18:23:08 -0600 )edit

you tried target_link_libraries (pose_sensor boost_system) as well, may be boost should install sudo apt-get install libboost-all-dev

hiranya gravatar image hiranya  ( 2013-04-02 23:34:09 -0600 )edit

I put my target_link_libraries (pose_sensor boost_system) after my target_link_libraries(pose_sensor ssf_core) and for apt-get install libboost-all-dev the results I get is 0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded. Still get error haha..

ROS_NOOB_CYBORG gravatar image ROS_NOOB_CYBORG  ( 2013-04-03 16:50:10 -0600 )edit

I'd remove the multiple calls to add_boost_directories, and play with the ordering of commands.

tfoote gravatar image tfoote  ( 2013-05-06 14:58:42 -0600 )edit

Question Tools

Stats

Asked: 2013-03-31 21:30:18 -0600

Seen: 2,767 times

Last updated: Apr 01 '13