0

Have Already read dozens of post on the subject but nothing seems to match my problem.

So, I've upgraded my VS2013 'VS2015'.

I have dozens of projects in my solution using boost as additional library. I've also recompile boost.

when compiling my projects I get this error.

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

lib libboost_thread-vc120-mt-s-1_55.lib used to exists when I compiled boost for VS2013. But after compiling boost for VS2015 the lib name has changed to libboost_thread-vc140-mt-s-1_55.lib (which is great).

Question

Why does the linker looking for file libboost_thread-vc120-mt-s-1_55.lib. How does it knows which file to link?

Community
  • 1
  • 1
idanshmu
  • 5,061
  • 6
  • 46
  • 92
  • 1
    http://www.boost.org/doc/libs/1_55_0/boost/config/auto_link.hpp vs http://www.boost.org/doc/libs/1_57_0/boost/config/auto_link.hpp (hint: search for `vc120` and `vc140`). – llonesmiz Mar 31 '16 at 14:03
  • 1
    [Here](http://stackoverflow.com/questions/19817163/how-do-i-specify-which-version-of-boost-library-to-link-to) is an older question with essentially the same problem. – llonesmiz Mar 31 '16 at 14:25
  • 1
    @jv_ has it right: you need a new enough Boost that understands VS2015 properly. Upgrading Boost to latest should do it. – Niall Douglas Mar 31 '16 at 21:49

1 Answers1

0

I had the exact same problem converting from VS2013 to VS2015, and at the same time changing Boost version from 1.59 to 1.61.

After two days of googling, SO'ing and trying out different variants, I seem to have ended up with a working solution, although I don't know why.

I compiled Boost (I believe exactly like the four previous attempts) using VS2015 x86 Native Tools Command Prompt with:

> "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
> .\bootstrap
> .\b2 install --prefix="<MY_BOOST_DIR>\msvc14" --buildtype=complete --build-dir="<MY_BOOST_DIR>\build" toolset=msvc-14.0 variant=release,debug link=shared -j4 --address-model=32

After this I tried compiling my very simple test

#include <boost\filesystem.hpp>
#include <iostream>

int main()
{
    boost::filesystem::path rootpath = boost::filesystem::current_path();

    std::cout << rootpath.string() << std::endl;
    std::cin.ignore();
    return 0;
}

With the appropriate Boost directories set for include and lib dirs. While the file 'libboost_filesystem-vc140-mt-gd-1_61.lib' verifiably is at the lib folder, VS2015 still complained it couldn't find the file.

As a last random poke at it, I changed my target platform to x64, after which the linker error changed to a warning about the conflict: warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' ...so for some reason, now VS was able to find the file! After which changing the target back to X86 resulted in a working configuration, while nothing really changed.

Could somebody explain/verify this? Does this solve your case, @idanshmu?

k_ride
  • 68
  • 1
  • 7