Linker errors when trying to build bag reader application [closed]

asked 2017-07-27 09:25:04 -0500

BlurEffect gravatar image

updated 2017-07-27 11:14:24 -0500

gvdhoorn gravatar image

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:

  • 1>RosbagReader2010.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall rosbag::View::iterator::~iterator(void)" (??1iterator@View@rosbag@@QAE@XZ)" in Funktion "_wmain".
  • 1>RosbagReader2010.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""private: void __thiscall rosbag::View::iterator::increment(void)" (?increment@iterator@View@rosbag@@AAEXXZ)" in Funktion ""private: static void __cdecl boost::iterator_core_access::increment<class rosbag::view::iterator="">(class rosbag::View::iterator &)" (??$increment@Viterator@View@rosbag@@@iterator_core_access@boost@@CAXAAViterator@View@rosbag@@@Z)".
  • 1>RosbagReader2010.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""private: class rosbag::MessageInstance & __thiscall rosbag::View::iterator::dereference(void)const " (?dereference@iterator@View@rosbag@@ABEAAVMessageInstance@3@XZ)" in Funktion ""private: static class rosbag::MessageInstance & __cdecl boost::iterator_core_access::dereference<class rosbag::view::iterator="">(class rosbag::View::iterator const &)" (??$dereference@Viterator@View@rosbag@@@iterator_core_access@boost@@CAAAVMessageInstance@rosbag@@ABViterator@View@3@@Z)".
  • 1>RosbagReader2010.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""private: bool __thiscall rosbag::View::iterator::equal(class rosbag::View::iterator const &)const " (?equal@iterator@View@rosbag@@ABE_NABV123@@Z)" in Funktion ""private: static bool __cdecl boost::iterator_core_access::equal<class rosbag::view::iterator,class="" rosbag::view::iterator="">(class rosbag::View::iterator const &,class rosbag::View::iterator const &,struct boost::mpl::bool_<1>)" (??$equal@Viterator@View@rosbag@@V123@@iterator_core_access@boost@@CA_NABViterator@View@rosbag ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2018-01-30 22:41:44.159410