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

Revision history [back]

click to hide/show revision 1
initial version

According to the API documentation it seems the right way how to create a Bag instance is

rosbag::Bag bag;

According to In your code above, you show a c++ code where in your main function you create a rosbag instance by command ros::Bag bag;. This is causing the API documentationerror

/home/cyx/test-catkin_ws/src/read/read.cpp:35:2: error: ‘Bag’ is not a member of ‘ros’
 it seems  ros::Bag bag;

because Bag is NOT member of ros. The Bag class is member of rosbag that you import on the right line 2

#include <rosbag/bag.h>

The correct way how to create a Bag rosbag instance isis

rosbag::Bag bag;

NOT the

 ros::Bag bag;

See the difference?