Ask Your Question
2

Linking error when catkin_make actionlib tutorial

asked 2012-12-26 12:09:53 -0500

130s gravatar image

updated 2012-12-26 12:28:39 -0500

I'm adding catkin version to actionlib tutorial. I'm able to create .msg and .h files by catkin_make (so that tutorial is updated) but building .cpp file fails with the following error. Any idea?

Linking CXX executable /useri/ROS/groovy_precise/Tutorial_ROS/catkin_ws_common_tutorials/devel/lib/learning_actionlib/fibonacci_server
[ 86%] [ 95%] Built target learning_actionlib_genpy
Built target learning_actionlib_gencpp
CMakeFiles/fibonacci_server.dir/src/fibonacci_server.cpp.o: In function `main':
fibonacci_server.cpp:(.text+0x70): undefined reference to `ros::init(int&, char**, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
fibonacci_server.cpp:(.text+0x93): undefined reference to `ros::this_node::getName()'
fibonacci_server.cpp:(.text+0xd5): undefined reference to `ros::spin()'
CMakeFiles/fibonacci_server.dir/src/fibonacci_server.cpp.o: In function `ros::Duration::Duration(double)':
fibonacci_server.cpp:(.text._ZN3ros8DurationC2Ed[_ZN3ros8DurationC5Ed]+0x2b): undefined reference to `ros::DurationBase<ros::Duration>::fromSec(double)'
CMakeFiles/fibonacci_server.dir/src/fibonacci_server.cpp.o: In function `boost::detail::thread_data_base::thread_data_base()':
fibonacci_server.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base'
CMakeFiles/fibonacci_server.dir/src/fibonacci_server.cpp.o: In function `boost::detail::interruption_checker::interruption_checker(pthread_mutex_t*, pthread_cond_t*)':
fibonacci_server.cpp:(.text._ZN5boost6detail20interruption_checkerC2EP15pthread_mutex_tP14pthread_cond_t[_ZN5boost6detail20interruption_checkerC5EP15pthread_mutex_tP14pthread_cond_t]+0x16): undefined reference to `boost::detail::get_current_thread_data()'
CMakeFiles/fibonacci_server.dir/src/fibonacci_server.cpp.o: In function `FibonacciAction::FibonacciAction(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
fibonacci_server.cpp:(.text._ZN15FibonacciActionC2ESs[_ZN15FibonacciActionC5ESs]+0x4e): undefined reference to `ros::NodeHandle::NodeHandle(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
:

(entire output is available here)

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(learning_actionlib)

find_package(catkin REQUIRED COMPONENTS roscpp actionlib std_msgs actionlib_msgs genmsg message_generation)

find_package(Boost REQUIRED COMPONENTS system)

add_action_files(
  DIRECTORY action
  FILES Fibonacci.action
)

generate_messages(
  DEPENDENCIES std_msgs actionlib_msgs # Or other packages containing msgs
)

catkin_package(
#  INCLUDE_DIRS include
  CATKIN_DEPENDS roslib roscpp actionlib message_generation
)

include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})

add_executable(fibonacci_server src/fibonacci_server.cpp)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-12-26 13:24:36 -0500

130s gravatar image

updated 2012-12-26 13:25:31 -0500

@Dirk Thomas solved by adding the following to CMakeLists.txt

target_link_libraries(
  fibonacci_server
  ${catkin_LIBRARIES}
)
edit flag offensive delete link more

Comments

1

I'll also note that the "find_package(catkin REQUIRED COMPONENTS .... )" line is different from what was previously listed in the wiki. The wiki minimal CMakeLists.txt has been updated to include roscpp actionlib in this list which was required for me to link correctly.

jamuraa gravatar image jamuraa  ( 2013-01-21 12:35:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-12-26 12:09:53 -0500

Seen: 3,154 times

Last updated: Dec 26 '12