Robotics StackExchange | Archived questions

How to use ROS to send a message on a c++ file?

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/correspondencegrouping.dir/correspondencegrouping.cpp.o: In function main': correspondence_grouping.cpp:(.text+0xa1f): undefined reference toros::Publisher::~Publisher()' correspondencegrouping.cpp:(.text+0x1de6): undefined reference to `ros::console::ginitialized' correspondence_grouping.cpp:(.text+0x1df5): undefined reference to `ros::console::initialize()'

So, does anyone knows how to solve this?

Asked by David_xiong on 2013-07-17 04:10:03 UTC

Comments

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"

Asked by Lucile on 2013-07-17 04:40:37 UTC

Also show the CMakeLists.txt. It looks like you are not building for ROS.

Asked by dornhege on 2013-07-17 07:53:56 UTC

Answers