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

Trouble Including rosbag

asked 2014-01-08 16:53:32 -0600

mysteriousmonkey29 gravatar image

updated 2014-07-19 19:43:19 -0600

ahendrix gravatar image

Hello, I am trying to follow this tutorial: http://wiki.ros.org/rosbag/Code%20API... , but am running into errors with the inclusion of rosbag. When I try to run the example code, I get a jillion lines of errors all saying something like this: undefined reference to rosbag:somethingOrOther. However, I don't know what I'm doing wrong. I included rosbag/bag.h and rosbag/view.h in my C++ source file, and I believe I've linked the libraries correctly in my CMakelists file:

add_executable(rosbagger src/rosbagger.cpp) target_link_libraries(rosbagger ${catkin_LIBRARIES})

Anyone know whats going wrong?

edit retag flag offensive close merge delete

Comments

open the terminal and type ($ rospack depends1 <package_name>) in dependencies list do you see rosbag?

Hamid Didari gravatar image Hamid Didari  ( 2014-01-08 18:31:19 -0600 )edit

Thanks I tried that and it said there were no dependcies so I recreated the package (with the correct dependcies) and now it seems to be working.

mysteriousmonkey29 gravatar image mysteriousmonkey29  ( 2014-01-12 07:03:42 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-01-08 19:27:08 -0600

You also have to specify rosbag as a dependency of your package correctly. The first example package I found where this is done is https://github.com/ros-perception/perception_pcl/tree/hydro-devel/pcl_ros. Have a look at the package package.xml and CMakeLists.txt files, search for "rosbag" and add the analogous (basically the same) lines to your package.

Also have a look at the related catkin wiki pages.

edit flag offensive delete link more

Comments

I have specified my dependencies as follows in the package.xml: <build_depend>rosbag</build_depend> <run_depend>rosbag</run_depend> However, I am still encountering the problem (I already had these lines in there; I just forgot to include them in the question)

mysteriousmonkey29 gravatar image mysteriousmonkey29  ( 2014-01-12 06:42:18 -0600 )edit

You probably forgot to insert "rosbag" under find_package(catkin REQUIRED COMPONENTS ...

artosaari gravatar image artosaari  ( 2014-07-18 05:09:50 -0600 )edit

This was very helpful. I was missing the CMakeLists.txt part. Thanks!

Clancy gravatar image Clancy  ( 2015-01-27 10:02:43 -0600 )edit

hi,what need to add in cmake?could plz be more specific?

resplendent star gravatar image resplendent star  ( 2021-03-12 06:25:26 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-01-08 16:53:32 -0600

Seen: 5,141 times

Last updated: Jul 19 '14