Search code examples
c++boostwindows-7-x64boost-filesystem

Including boost libraries in C++ Win x64 application


I have a C++ console application which I successfully compiled for windows x86 platforms using Microsoft SDK compiler. Now, I want to compile the same source code for x64 systems. I am using boost libraries (file systems, program options and some other methods). I have recompiled boost libraries for x64 systems ( using "bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage"). Now when I try to compile the source file it complains about boost libraries.

Previously I included "libboost_filesystem-vc120-mt-1_55.lib" and successfully compiled. Now I include "boost_filesystem-vc90-mt-1_55.lib", but the linker complains:

LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-1_55.lib'

I don't know why it still asks for "libboost_filesystem-vc120-mt-1_55.lib" library.

Thanks in advance,

Serhat


Solution

  • For binary compatibility reasons you cannot link boost compiled with a different compiler than the one you are using. In this case you're using vc120 for your main compiler but are compiling boost with vc90. The two toolsets do not (deliberately) produce binary compatible results.

    In this case you need to compile boost in the vs2012 x64 native command prompt that the IDE comes with. This will produce the libraries you need.