Ask Your Question

unable to compile a simple publisher node

asked 2014-09-23 00:11:05 -0500

ASHISH CHHONKAR gravatar image

when i tried to compile a simple node of publish, it give me following error

chhonkar@CHHONKAR:~/Desktop/beginner_tutorials/src$ g++ hellop.cpp -o hellop -I/opt/ros/indigo/include -L/opt/ros/indigo/lib -Wl,-rpath,/opt/ros/indigo/lib -lroscpp -lrosconsole -lrostime

error :

 /usr/bin/ld: /tmp/ccBLS7zj.o: undefined reference to symbol '_ZN3ros13serialization18throwStreamOverrunEv'
 /opt/ros/indigo/lib/ error adding symbols: DSO missing from command line
 collect2: error: ld returned 1 exit status

my code written in cpp is as follow :

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "sstream"
using namespace ros;
int main (int argc, char**argv)
  init (argc,argv,  "hellop");
  NodeHandle n;
  Publisher chatter_pub = n.advertise<std_msgs::String>("chatter",1000);    
  Rate loop_rate(10);
int count = 0;
while (ros::ok())
    std_msgs::String msg;
    std::stringstream ss;
    ss<<"hello oye londe"<<count; = ss.str();
return 0;


edit retag flag offensive close merge delete



you should really be using cmake to compile your nodes, as described in the tutorials.

ahendrix gravatar image ahendrix  ( 2014-09-23 00:44:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-09-23 03:07:02 -0500

bvbdort gravatar image

Link in your build command but not sure of compilation if any other libraries are missing.

Correct way would be to create a ROS package CreatingPackage make things easy and add your source and update CMakeLists.txt and then build with catkin_make.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-09-23 00:11:05 -0500

Seen: 1,444 times

Last updated: Sep 23 '14