How to use ROS to send a message on a c++ file? [closed]
Hi all,
I have successfully rosmaked the Correpsondence Grouping Tutorial(a tutorial in PCL), and now I want to send a message to a topic if I recognized the target in correspondence grouping. However, the correspondence grouping tutorial doesn't use any thing about ros before, so I wonder to know how to emerge ROS in this tutorial.
I tried to add the code like the tutorial: WritingPublisherSubscriber(c++)(http ://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29), and modified my cmakelist, but I always get the error:
CMakeFiles/correspondence_grouping.dir/correspondence_grouping.cpp.o: In function main':
correspondence_grouping.cpp:(.text+0xa1f): undefined reference to
ros::Publisher::~Publisher()'
correspondence_grouping.cpp:(.text+0x1de6): undefined reference to ros::console::g_initialized'
correspondence_grouping.cpp:(.text+0x1df5): undefined reference to
ros::console::initialize()'
So, does anyone knows how to solve this?
I think it would be easier to help you if you show your code. Are you sure you added the required includes ? #include "ros/ros.h"
Also show the CMakeLists.txt. It looks like you are not building for ROS.