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

How do I solve undefined reference to interactive_markers

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

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.


edit retag flag offensive close merge delete


I have exactly the same error and I could not solve it with these recommendations. Has anyone else had this same error?

karen.rod gravatar image karen.rod  ( 2020-08-30 11:36:38 -0500 )edit

I have the same error but my CMakelist.txt is so big and complicated that the recommendations do not work at all :(

Kansai gravatar image Kansai  ( 2021-03-09 07:34:45 -0500 )edit

Yeah, I'm also getting the same error again and again. As a beginner, it is too hard to figure out what is really going on.

Turuu gravatar image Turuu  ( 2023-04-14 10:08:27 -0500 )edit

1 Answer

Sort by » oldest newest most voted

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

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


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 image TFinleyosu  ( 2013-12-06 04:35:40 -0500 )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 image TFinleyosu  ( 2013-12-11 04:31:28 -0500 )edit

Thanks, @stefan. This solved my problem too.

tangeni gravatar image tangeni  ( 2020-10-13 16:35:20 -0500 )edit

Question Tools



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

Seen: 2,450 times

Last updated: Dec 04 '13