ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to compile the listener.cpp and talker.cpp without cmake

asked 2016-01-05 13:36:06 -0500

arttp2 gravatar image

Upon reading the following tutorial Simplest ROS tutorial, I wanted to compile the listener.cpp and talker.cpp given here.

I am using the following command, as directed by the tutorial:

g++ listener.cpp -o listener_node -I/opt/ros/indigo/include -L/opt/ros/indigo/lib -Wl,-rpath,/opt/ros/indigo/lib -lroscpp -lrosconsole -lrostime

I get the following error:

/usr/bin/ld: /tmp/ccbskyfi.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

How can I resolve the issue and run the code?

** I did not include the message header files since they should already be included by:

-I/opt/ros/indigo/include -L/opt/ros/indigo/lib
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-05 13:47:43 -0500

ahendrix gravatar image

The missing symbol here is _ZN3ros13serialization18throwStreamOverrunEv, which comes from . You should link to it by adding -lroscpp_serialization to you compile flags.

In general, may of the ROS packages that you'll use from C++ provide a large number of include directories and libraries, and using cmake with catkin handles the inclusion and order of these dependencies for you. It's good to understand the basics, but I strongly encourage you to use cmake on more complex projects.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-01-05 13:36:06 -0500

Seen: 463 times

Last updated: Jan 05 '16