2>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc120-mt-sgd-1_58.lib'

Mr_and_Mrs_D picture Mr_and_Mrs_D · Apr 22, 2015 · Viewed 16.5k times · Source

And no wonder as there is no such file in ...\boost_1_58_0\stage\lib. How can I get one ? I only have:

boost_1_58_0\stage\lib\libboost_filesystem-vc120-mt-s-1_58.lib
boost_1_58_0\stage\lib\libboost_filesystem-vc120-s-1_58.lib

in there. Tried to compile boost with various options ending up with tacking --build-type=complete to it (the "poor man's" solution from Linker error LNK1104 with 'libboost_filesystem-vc100-mt-s-1_49.lib') to get:

> b2 toolset=msvc threadapi=win32 link=static runtime-link=static \
variant=release address-model=32 --with-filesystem --with-locale --with-regex \
--with-system --with-iostreams --build-type=complete

the command line being suggested in the readme of the project that I am importing - still no joy. It is a CMake project I got into some pains to build an MSVS solution for.

NB: my problem was solved when looking carefully at the CMake gui:

enter image description here

I realized that it is the Debug configuration that did not build and sure enough when I right clicked on the "solution" > Configuration Manager > changed to a release build all was ok. Still the question remains - how do I get those libboost_filesystem-vc120-mt-sgd-1_58.lib builds ?

Answer

Fraser picture Fraser · Apr 23, 2015

You'd need to have runtime-link=static runtime-debugging=on variant=debug in the b2 command line args to get sgd.

From the boost docs about library naming on Windows (specifically the ABI tag portion):

ABI tag: encodes details that affect the library's interoperability with other compiled code. For each such feature, a single letter is added to the tag:

Key  |  Use this library when:                                |  Boost.Build option
=====================================================================================
 s   |  linking statically to the C++ standard library and    |  runtime-link=static
     |  compiler runtime support libraries.                   | 
-------------------------------------------------------------------------------------
 g   |  using debug versions of the standard and runtime      |  runtime-debugging=on
     |  support libraries.                                    |
-------------------------------------------------------------------------------------
 y   |  using a special debug build of Python.                |  python-debugging=on
-------------------------------------------------------------------------------------
 d   |  building a debug version of your code.                |  variant=debug
-------------------------------------------------------------------------------------
 p   |  using the STLPort standard library rather than the    |  stdlib=stlport
     |  default one supplied with your compiler.              |