Visual Studio 2013 (vs120) asks for wrong boost libraries - c++

I'm trying to compile one of my projects on Windows 7, using Visual Studio 2013. I've installed Boost 1.53 and setup the solution using cmake.
What happens is that now the compiled libraries of boost are in the form libboost_*-vc120-mt(-gd)-1_53.lib. In the linker project options, under the input tab, I have verified that the libraries that I need are there, and in fact the compiler is able to correctly read them.
However, for some reason that I absolutely can't understand, the linker is also trying to find libraries compiled as vc110. For example:
error LNK1104: cannot open file 'libboost_filesystem-vc110-mt-gd-1_53.lib'
The Platform Toolset that is listed in the project option is "Visual Studio 2013 (v120)". I couldn't find any reference to vc110 in any of the project options. Can you help me understand what is happening?

This post thankfully solves my question. I wasn't able to find it before. The solution is to edit the boost/config/auto_link.hpp because the code inside is not able to handle vc120, and ends up suggesting vc110
How do I specify, which version of boost library to link to?

The library name is autogenerated in the boost header version.hpp
Possibly the version wasn't rebuilt, or you are pointing at the wrong header version?

Instead of patching the config file try just defining a macro before the header inclusion .. this is what I did in my project
//#define BOOST_LIB_TOOLSET "vc100"
//#include

Related

Use MinGW static library (.a) within Visual studio environment

I work on a project that generate several static libraries (.a) from MinGW with Scons project files.
And I need to use these libs into an other project that work on C++ Visual Studio 2013.
First I tried to just add MinGW lib to my VS project and obviously it didn't work out.
I read some things about using a ".def" file to switch from ".lib" to ".a" but found nothing about convertion from ".a" to ".lib". But I have no idea how to get this ".def" file.
Does anyone have some clue that what I am trying to realise is possible (use MinGW into VS2013) ? Or even a solution that can help me :)
Mathieu.

libboost_system on Windows

While compiling a DLL in Visual Studio 2013 I include some boost (1.58) header files. One is <boost/system/error_code.hpp>. As it is known this will require to link to a boost lib, by default. However, I want to use the header only variant and not handle yet another library. For that I figured out how to make it work on Linux + Mac. However, I cannot get this to work on Windows. The linker always wants that additional library (libboost_system-vc120-mt-gd-1_58.lib)
What's the trick in Visual Studio to avoid linking to that lib?
Ok, I found it myself. This is not mentioned anywhere in questions about boost libs including on Windows. But if you search for disabling boost auto linking (which is actually the culprit including the libs) you will find the solution: define BOOST_ALL_NO_LIB at project level (in addition to the header only flag mentioned in the other question).

VS2013 Boost using NuGet

I have been trying for days to get boost to work with my Visual Studio 2013 Premium install. I tried it with a zip install, and now with NuGet. Both methods have gotten me to same point of a linker error.
The error: 1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc120-mt-gd-1_57.lib'
I looked through the mailing list for boost and found someone posting of a similar issue, but that was from 2012 with boost_1_54_0 or something, so not relevant at all to VS2013 or boost 1_58_0.
I've also looked at a few forum posts, including SO, but none of them have the same issue I'm having. Either that, or they simply have no replies.
I can't really discern any of the flags that the error show because this is my first time ever using anything other than STL libraries or my own headers.
Any and all help would be appreciated, let me know if there's any other additional info that would be helpful.
I suspect you installed the NuGet package named simply "boost". This seems to contain all the Boost headers, but no compiled libraries. That's fine if you're interested in using only the header-only Boost libraries (i.e. most of them).
What you really want is the package named "boost-vc120" (vc120 refers to VC++ 12.0, which is the VC++ version that ships with VS2013). This has all the libraries as well. You'll notice that it'll take a lot longer to install.
In either case, NuGet will take care of setting up all the necessary VC++ Directories settings. No further configuration is needed.
The structure of Boost NuGet packages is here. You can use boost-vc120 but it will download ALL boost libraries to your project. So if you want to save disk space, then use boost package which gives you header files, and specific binary packages. In your case, it's boost_system-vc120.
You can't remove boost package because binary packages, such as boost-vc120/boost_system-vc120, depend on it.
Does the file libboost_system-vc120-mt-gd-1_57.lib exist on your hard drive?
If yes, did you add the .lib to the linker/input/Additional Dependencies?
Go to following web page:
https://github.com/sergey-shandar/getboost
From there you find "NuGet Packages for Boost." with multiple links.
If you pick first link - you will get to boost-includes nuget-package
instructions. Basically you need to open Package manager in Visual studio, select correct project, and type command "Install-Package boost -Version 1.69.0" - it will enable
boost includes automatic downloading to "packages" folder.
By following other links you can get boost static libraries for your specific Visual studio - follow "boost-vc141" to get Visual studio 2017 static libraries.
That boost package will get a lot of boost libraries - if you don't need all of them - make temporary project, get boost static libraries, and copy paste libraries which you need by yourself.

Building & Linking FreeImage with Visual Studio Express 2013

I'm having a lot of trouble linking my project with FreeImage library with VSE 2013
I've followed this answer for VS2010 to no avail: Linking FreeImage as a static library in VS2010?
I am getting LNK2019 errors when calling FreeImage functions.
I've linked the library just as I would any library. Below are the following steps I made:
Download FreeImage Source.
Open the 2008 Solution (converted to 2013) and changed Code Generation to /MDd for all projects
Attempted to build project but for some reason min/max functions were not defined So I included algorithm.h to those files and that stopped those errors.
Attempted to build project and I get an error: "Could not open "afxres.h". So I swapped afxres.h with windows.h as suggested in another topic.
Built the project -> success
Copied Fresh FreeImaged.lib to to my project
Added directory to "Additional Library Directories"
Added FreeImaged.lib to Additional Dependencies under linker
Copied FreeImaged.dll to my debug folder where the .exe is being built
Added FreeImage.h to the project
Added #define FREEIMAGE_LIB before including the header
Attempted to build my project -> LNK2019s everywhere.
If anyone has been able to build FreeImage on VS2013 and could share how they did it I would greatly appreciate it, or if anyone has any suggestions.
The reason for your troubles is that with Visual Studio 2013 some breaking changes (as outlined by Microsoft) were introduced in related to C++11 conformity.
One includes that in order to use std::min()/std::max(), you now have to include the header . This also concerns FreeImage. Unfortunately, up until version 3.6.1 (the most recent as of today) this hasn't been fixed yet.
This blog post explains what you need to do to get it to compile. The most relevant part is:
Specifically, you will need to add
include <algorithm>
to the following files:
Source/OpenEXR/IlmImf/ImfOutputFile.cpp
Source/OpenEXR/IlmImf/ImfScanLineInputFile.cpp
Source/OpenEXR/IlmImf/ImfTiledMisc.cpp
Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp
Source/OpenEXR/Imath/ImathMatrixAlgo.cpp
I was able to get this to work by going into the Configuration Manager unchecking FreeImage and checking FreeImageLib under build. Also disabling whole program optimization seems to make the binary size more normal and, gets rid of warnings when linking.
I know this question is over a year old. Just providing an answer to anyone google searching this problem like me.
version: FreeImage3170Win32Win64.zip
os.env.: win7 64bit visualstudio ULTIMATE 2013
operation:
1_ just unpacking the zip somewhere
e.g. (D:/library/FreeImage3170Win32Win64/FreeImage)
2_ in C/C++->General->Additional Including Directerories
add (D:/library/FreeImage3170Win32Win64/FreeImage/Dist/x32)
3_ in Linker->General->Additional Library Directerories
add (D:/library/FreeImage3170Win32Win64/FreeImage/Dist/x32)
4_ in Linker->Input->Additional Dependency
add (FreeImage.lib)
PS0: i just add a new entry to Include Directories and Library
Directories and FreeImage.lib to Linker->input in Visual Studio without rebuild the FreeImage library
:)
PS1: error LNK2019 occured when i added the FreeImage/Dist/x64 option
;( ( got no idea about this)
maybe this helps :)

how to install boost to the VS 2008?

I've almost completely installed Boost, but I have a problem with how to set my path to Boost in Tools->options->projects->VC++ Directories.
I've written the path to include files and libraries (my folder contains two subfolders, lib and include), but when I try to use Boost with
#include boost/regex.hpp, I got this linking error:
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_36.lib
Could you please tell me how to install Boost correctly for Visual Studio 2008?
Use the Boost Installer by the Boost consulting group.
You might be interested in the Visual Studio 2008 Feature pack. It adds many of the features that have only been available from Boost until now, the features that are part of the C++ TR1.
Also checkout this post for instructions on how to build Boost yourself.