Ask Your Question
0

How do I solve undefined reference to interactive_markers

asked 2013-12-04 10:49:26 -0600

TFinleyosu gravatar image

I am trying to compile the simple_marker.cpp tutorial with catkin_make in Hydro and I am getting an undefined reference error:


> CMakeFiles/simple_marker.dir/src/simple_marker.cpp.o: In function `main':
simple_marker.cpp:(.text+0x362): undefined reference to `interactive_markers::InteractiveMarkerServer::InteractiveMarkerServer(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
simple_marker.cpp:(.text+0x549): undefined reference to `interactive_markers::InteractiveMarkerServer::insert(visualization_msgs::InteractiveMarker_<std::allocator<void> > const&, boost::function<void (boost::shared_ptr<visualization_msgs::InteractiveMarkerFeedback_<std::allocator<void> > const> const&)>, unsigned char)'
simple_marker.cpp:(.text+0x567): undefined reference to `interactive_markers::InteractiveMarkerServer::applyChanges()'
simple_marker.cpp:(.text+0x5b7): undefined reference to `interactive_markers::InteractiveMarkerServer::~InteractiveMarkerServer()'
simple_marker.cpp:(.text+0x62b): undefined reference to `interactive_markers::InteractiveMarkerServer::~InteractiveMarkerServer()'
simple_marker.cpp:(.text+0x662): undefined reference to `interactive_markers::InteractiveMarkerServer::~InteractiveMarkerServer()'
simple_marker.cpp:(.text+0x6f7): undefined reference to `interactive_markers::InteractiveMarkerServer::~InteractiveMarkerServer()'
collect2: ld returned 1 exit status
make[2]: *** [/home/taylor/src/ros/catkin_ws/devel/lib/beginner_tutorials/simple_marker] Error 1
make[1]: *** [beginner_tutorials/CMakeFiles/simple_marker.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

I think it's because of my CMakeFiles.txt:

> # %Tag(FULLTEXT)% cmake_minimum_required(VERSION 2.8.3)
> project(beginner_tutorials)
> 
> ## Find catkin and any catkin packages find_package(catkin REQUIRED
> COMPONENTS roscpp rospy std_msgs
> genmsg)
> 
> ## Declare ROS messages and services
> #add_message_files(FILES Num.msg)
> #add_service_files(FILES AddTwoInts.srv)
> 
> ## Generate added messages and services
> #generate_messages(DEPENDENCIES std_msgs)
> 
> ## Declare a catkin package catkin_package(
> ##  INCLUDE_DIRS include
> ##  LIBRARIES pick
> ##  CATKIN_DEPENDS roscpp rospy std_msgs
> ##  DEPENDS system_lib )
> 
> ## Build talker and listener include_directories(include
> ${catkin_INCLUDE_DIRS})
> 
> add_executable(talker src/talker.cpp)
> target_link_libraries(talker
> ${catkin_LIBRARIES})
> add_dependencies(talker
> beginner_tutorials_generate_messages_cpp)
> 
> add_executable(listener
> src/listener.cpp)
> target_link_libraries(listener
> ${catkin_LIBRARIES})
> add_dependencies(listener
> beginner_tutorials_generate_messages_cpp)
> 
> add_executable(simple_marker
> src/simple_marker.cpp)
> target_link_libraries(simple_marker
> ${catkin_LIBRARIES})
> add_dependencies(simple_marker
> beginner_tutorials_generate_messages_cpp)
> 
> # %EndTag(FULLTEXT)%

I am able to run the basic controls tutorial in rviz, but I did not compile it, just installed the package and ran: rosrun interactive_marker_tutorials basic_controls

Can someone let me know if it is a CMakeLists thing or am I way off. I have not been able to find a CMakeLists example for an interactive marker node.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

answered 2013-12-04 17:52:05 -0600

It appears you don´t have the dependency on the interactive_markers package defined in your package. For an example of how to do that, you can look at the turtlebot_interactive_markers package, which is a pretty simple example of a package using interactive_markers in catkin. The relevant parts are in the CMakeLists.txt and package.xml files.

edit flag offensive delete link more

Comments

Thank you! I had been looking for an example and just couldn't find it. I'll respond when I get a results.

TFinleyosu gravatar imageTFinleyosu ( 2013-12-06 04:35:40 -0600 )edit

That did the trick! I was able to update my CMakeLists with the following: find_package(catkin REQUIRED COMPONENTS pcl_conversions pcl_ros roscpp sensor_msgs visualization_msgs interactive_markers ) I added the "visualization_msgs" and "interactive_markers" and it worked. Thanks.

TFinleyosu gravatar imageTFinleyosu ( 2013-12-11 04:31:28 -0600 )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

1 follower

Stats

Asked: 2013-12-04 10:49:26 -0600

Seen: 1,809 times

Last updated: Dec 04 '13