Search code examples
c++boostlinkermemory-mapped-files

Linking boost memory mapped files


I have a program that I started on linux Debian, so linking there was quite easy. All I had to do was the command lines:

LIBS += -lboost_system -lboost_iostreams

Now I have to compile the same program on Windows. I downloaded boost version 1.58, and executed bootstrap then bjam. This compiled boost and created the stage folder which contained all the libraries.

Now I'm using the memory mapped file class boost::iostreams::mapped_file_source(), so I'm getting multiple linking errors, from which I mention as an example:

FileCheck.obj:-1: error: LNK2019: unresolved external symbol "public: char const * __cdecl boost::iostreams::mapped_file_source::data(void)const " (?data@mapped_file_source@iostreams@boost@@QEBAPEBDXZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl MD5FromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?MD5FromFile@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV12@@Z)

I tried to link to boost for this. So I added boost's path and :

LIBS += -L"X:/Path/to/boost/boost_1_58_0/stage/lib"
LIBS += -llibboost_system-vc120-mt-1_58    -llibboost_iostreams-vc120-mt-1_58
LIBS += -llibboost_system-vc120-mt-gd-1_58 -llibboost_iostreams-vc120-mt-gd-1_58

But still I get this error. Now I would like to point out that the compiler (VS2013) finds the lib files, but it's apparently not sufficient.

I also would like to mention that I use Boost::ASIO too and OpenSSL, but these link with no problems.

Any idea how to link to boost memory mapped files?

Thanks.


Solution

  • Sure about 32 or 64 bits library version ? if you build in 32 and the library is in 64 that can appear.