Linker errors when trying to build bag reader application [closed]
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:
- I got the pre-compiled SDK for Windows from http://wiki.ros.org/win_ros/hydro/Msv... and followed the steps for installing it. I validated that it's working as expected (part 3 of the instructions)
- I set up a new project in Visual Studio 2010 according to this guide http://wiki.ros.org/win_ros/hydro/Msv...
- I took the code from the Reader example here http://wiki.ros.org/rosbag/Code%20API and put it into the main.cpp file
- Since I was getting many linker errors, I added all ros-libs as linker Input, which resolved most of the Errors
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 ...