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

Compiling rosbag C++11 APi with just make: error "DSO missing"

asked 2020-04-14 20:28:56 -0500

sg gravatar image

updated 2020-04-14 21:10:27 -0500

File read.cc contains the rosbag C++11, non-boost, API example for reading a rosbag, enclosed inside main(){...}.

Following lines are in file m:

#!/bin/bash

gcc  -I/opt/ros/melodic/include read.cc  -c -o foo.o

gcc  foo.o \
     -L/opt/ros/melodic/lib \
     -lrosbag \
     -lrosbag_storage \
     -lrostime \
     -o foo.exe

Executing ./m results in:

$ ./m
/usr/bin/ld: foo.o: undefined reference to symbol '_ZN3ros6HeaderD1Ev'
/opt/ros/melodic/lib/libcpp_common.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

c++filt shows:

$  c++filt  _ZN3ros6HeaderD1Ev
Ros::Header::~Header()

So how can the commands in m be modified to result in a successful compilation for the C++API example ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-14 21:51:52 -0500

sg gravatar image

A tutorial at Robotics Back End helped reolve the issue; a m file that results in a successful build is:

#!/bin/bash

gcc -std=c++11 -I/opt/ros/melodic/include read.cc  -c -o foo.o

gcc  foo.o \
     -std=c++11   \
     -L/opt/ros/melodic/lib \
     -lrosbag_storage \
     -lrosbag \
     -lrostime \
     -lcpp_common  \
     -lboost_system \
     -lstdc++  \
     -lroscpp_serialization  \
     -o foo.exe
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-04-14 20:28:56 -0500

Seen: 311 times

Last updated: Apr 14 '20