How do I solve undefined reference to interactive_markers
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
I have exactly the same error and I could not solve it with these recommendations. Has anyone else had this same error?
I have the same error but my CMakelist.txt is so big and complicated that the recommendations do not work at all :(
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.