Seem I can't get this to work. I made a simple console application (which depend on websocket++
library) which need Boost
libraries.. but when I try to compile I get:
fatal error LNK1104: cannot open file 'libboost_system-vc110-mt-gd-1_51.lib'
However, I did the bjam which created the lib in (boost_root)/stage/libs
and I linked the path to the libs to the compiler C++/Additionnals includes
.
If I look in (boost_root)/stage/libs
the file libboost_system-vc110-mt-gd-1_51.lib
is not there. It is called libboost_system-vc110-mt-sgd-1_51.lib
instead.
Any idea?
In case you have trouble building boost or prefer not to do that, an alternative is to download the lib files from SourceForge. The link will take you to a folder of zipped lib and dll files for version 1.51. But, you should be able to edit the link to specify the version of choice. Apparently the installer from BoostPro has some issues.
Yet another solution:
I was stumped because I was including boost_regex-vc120-mt-gd-1_58.lib in my Link->Additional Dependencies property, but the link kept telling me it couldn't open libboost_regex-vc120-mt-gd-1_58.lib (note the lib prefix). I didn't specify libboost_regex-vc120-mt-gd-1_58.lib.
I was trying to use (and had built) the boost dynamic libraries (.dlls) but did not have the BOOST_ALL_DYN_LINK macro defined. Apparently there are hints in the compile to include a library, and without BOOST_ALL_DYN_LINK it looks for the static library (with the lib prefix), not the dynamic library (without a lib prefix).
b2 -j%cores% toolset=%msvcver% address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64
Properties ? Linker ? General ? Additional Library Directories $(BOOST)\stage\x64\lib
I had the same problem and my mistake was that I had installed the binary boost_1_55_0-msvc-11.0-32.exe to use with visual c++ 2010 which has the version v100 (project properties->ConfiguratioProperties->General->platformTooset) not v110 as visual c++ 2012. So I dowloaded boost_1_55_0-msvc-10.0-32.exe and now everything is ok so far.
2>LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc120-mt-sgd-1_55.lib
In my case, bootstrap/bjam was not available (libraries were precompiled and committed to SCM) on old inherited project. Libraries did not have VC or BOOST versioning in their filenames eg: libboost_regex-mt-sgd.lib
, however Processed /DEFAULTLIB:libboost_regex-vc120-mt-sgd-1_55.lib
was somehow triggered automatically.
Fixed by manually adding the non-versioned filename to:
<AdditionalDependencies>$(DK_BOOST)\lib64\libboost_regex-mt-sgd.lib</AdditionalDependencies>
and blacklisting the ...vc120-mt-sgd-1_55.lib
in
<IgnoreSpecificDefaultLibraries>libboost_regex-vc120-mt-sgd-1_55.lib</IgnoreSpecificDefaultLibraries>
I had a similar problem when trying to use boost unit testing in Visual Studio 2015 (Community Edition):
fatal error LNK1104: libboost_unit_test_framework-vc140-mt-1_57
so I thought I'd share my solution.
You can create a boost unit testing project in of of two ways (and this solution works for both):
Here are the steps I followed to get both projects to work:
First, download the desired boost version (for example, boost_1_57_0). You can either download boost with the correct binaries (compiled using msvc v140), or extract the binaries yourself by running the following commands from command line:
Where msvc-14.0 specifies that we require the Visual Studio 2015 version (VS 2015 = v14.0 = v140), and address-model=32 specifies that we require platform 32 (but the same can be done for 64 bit).
Once you have the binaries, go to Visual Studio, select the Boost Unit Testing project you have created. Go to Project properties > configuration (from the main menu) and make the following choices:
Set the "General > Platform Toolset" to Visual Studio 2015 (v140).
Include the path to the boost folder (e.g. C:\boost_1_57_0) and the path to the subfolder containing the binary files (e.g. C:\boost_1_57_0\stage\lib) in:
I had the same problem. It was caused because I compiled the Boost with the Visual C++ 2010(v100) and I tried to use the library with the Visual Studio 2012 (v110) by mistake.
So, I changed the configurations (in Visual Studio 2012) going to Project properties -> General -> Plataform Toolset and change the value from Visual Studio 2012 (v110) to Visual Studio 2010 (v100).
I had same issue reported here. I solved the issue moving the mainTest.cpp from a subfolder src/mainTest/ to the main folder src/ I guess this was your problem too.
This is the simplest way for an amateur like me who is studying C++ on their own:
First Unzip the boost library to any directory of your choice. I recommend c:\directory
.
c:\boost_1_57_0
.Then go over to the link library were you experienced your problems.
c:\boost_1_57_0
.booststrap.bat
(don't bother to type on the command window just wait and don't close the window that is the place I had my problem that took me two weeks to solve. After a while the booststrap
will run and produce the same file, but now with two different names: b2
, and bjam
.b2
and wait it to run.bjam
and wait it to run. Then a folder will be produce called stage
.c:\boost_1_57_0\stage\lib
.And you are good to go!
Source: Stackoverflow.com