Robotics StackExchange | Archived questions

Linker errors when trying to build bag reader application

Hi everybody,

I'm pretty new to ROS and trying to write an application in C++ on Windows 7 that is able to read .bag files. I'm stuck now and could really use some help. These are the things I have done so far:

However, I'm still stuck with four LNK2019 Errors, which seem to be related to the usage of iterators when accessing the view. Here is my complete code:

#include "stdafx.h"

#include <rosbag/bag.h>
#include <rosbag/view.h>
#include <std_msgs/Int32.h>
#include <std_msgs/String.h>

int _tmain(int argc, _TCHAR* argv[])
{
rosbag::Bag bag;
bag.open("test.bag", rosbag::bagmode::Read);

std::vector<std::string> topics;
topics.push_back(std::string("chatter"));
topics.push_back(std::string("numbers"));

rosbag::View view(bag, rosbag::TopicQuery(topics));

for(rosbag::View::iterator it = view.begin(); it != view.end(); ++it)
{
    std_msgs::String::ConstPtr s = it->instantiate<std_msgs::String>();
    if (s != NULL)
    {
        std::cout << s->data << std::endl;
    }

    std_msgs::Int32::ConstPtr i = it->instantiate<std_msgs::Int32>();
    if (i != NULL)
    {
        std::cout << i->data << std::endl;
    }
}

bag.close();
return 0;

}

And These are the errors I get when attempting to build:

Sorry, these contain some German words, which are saying "reference to an unresolved external symbol". I don't know which libs I could additionally include or generally what to do now to overcome this issue. Any help/hint is appreciated. Thank you very much in advance!

Asked by BlurEffect on 2017-07-27 09:25:04 UTC

Comments

Answers