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

asked 2013-07-17 04:10:03 -0500

David_xiong gravatar image

updated 2014-04-20 14:09:47 -0500

ngrennan gravatar image

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 toros::Publisher::~Publisher()' correspondence_grouping.cpp:(.text+0x1de6): undefined reference to ros::console::g_initialized' correspondence_grouping.cpp:(.text+0x1df5): undefined reference toros::console::initialize()'

So, does anyone knows how to solve this?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-03-09 17:10:57.462079

Comments

1

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"

Lucile gravatar image Lucile  ( 2013-07-17 04:40:37 -0500 )edit
3

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

dornhege gravatar image dornhege  ( 2013-07-17 07:53:56 -0500 )edit