Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 475

Cannot include rosbag as catkin dependency

$
0
0
I am having trouble including rosbag as a catkin dependency for my package (to use the C++ API). I have added it as both a build and run dependency in package.xml; i.e.,rosbagrosbag And it is included in the correct places in CMakeLists.txt; i.e., find_package(catkin REQUIRED COMPONENTS pcl_ros roscpp rosbag sensor_msgs ) and catkin_package( INCLUDE_DIRS include CATKIN_DEPENDS pcl_ros roscpp sensor_msgs rosbag ) Yet when I write the simple file #include #include #include #include int main() { rosbag::Bag bag; bag.open("test.bag", rosbag::bagmode::Read); std::vector topics; topics.push_back(std::string("chatter")); topics.push_back(std::string("numbers")); bag.close(); } I get the following when I invoke catkin_make: CMakeFiles/write_json.dir/src/write_json.cpp.o: In function `main': write_json.cpp:(.text.startup+0xe): undefined reference to `rosbag::Bag::Bag()' write_json.cpp:(.text.startup+0x32): undefined reference to `rosbag::Bag::open(std::string const&, unsigned int)' write_json.cpp:(.text.startup+0xd1): undefined reference to `rosbag::Bag::close()' write_json.cpp:(.text.startup+0xe5): undefined reference to `rosbag::Bag::~Bag()' write_json.cpp:(.text.startup+0xfd): undefined reference to `rosbag::Bag::~Bag()' collect2: error: ld returned 1 exit status Does anyone have any idea what I'm doing wrong?

Viewing all articles
Browse latest Browse all 475

Trending Articles