C++ boost nuget cannot open file Visual Studio 2015 - c++

I am making a C++ project (quite new to C++) and it needs the so called "boost" library. I thought I could add it with a nugget to make my life easier...(#include <boost\date_time.hpp> added) but now I am getting this error
Error LNK1104 cannot open file
'libboost_date_time-vc141-mt-gd-1_65_1.lib'
What is the problem?

Error LNK1104 cannot open file
'libboost_date_time-vc141-mt-gd-1_65_1.lib'
According to the error, you should add the libboost_date_time-vc141-mt-gd-1_65_1.lib library directory to your project configuration. This .lib included in the NuGet package boost_date_time-vc140 or boost_date_time-vc141.
Since you are using Visual Studio 2015, you just need install the NuGet package boost_date_time-vc140 to your project, NuGet will add the libboost_date_time-vc141-mt-gd-1_65_1.lib library directory to your project configuration automatically. After installation completed, that error will be resolved.
Besides, since you are use boost library in Visual Studio 2015, I suggest that you can use the boost-vc140, which included many dependencies. So you do not need to add them manually.
Hope this helps.

You need to add the boost library directory to your project configuration, go to the project menu, then properties.
In the property tree go down to 'VC++ Directories' and in the library directories add \lib64-msvc-12.0 (change the 64 to 32 for 32 bit builds).
I suggest you do this through view->other windows->property manager, then it will be set up for all future projects as well.

The reason why you have a link error is because you installed the header-only NuGet "Boost" package. However, due to an unfortunate design decision, this header-only package also contains header files for Boost libraries that are not header-only, such as datetime. With a better design, you would have gotten the error earlier (at compile time).
The "Boost.vc120" and "Boost.vc140" packages contains both header-only libraries and regular compiled libraries; the difference between them is the compiler used.

Related

Point Cloud Library with Visual Studio 2017

I'm having trouble using Point Cloud Library with Microsoft Visual Studio 2017.
I have installed [PCL-1.8.1-AllInOne-msvc2017-win64.exe] and I've followed the steps mentioned
here. to link it to my Visual Studio 2017 project.
My problem is that Visual Studio is not finding the header nor the source files of the library I need.
The error I'm getting is as follows:
[fatal error C1083: Cannot open include file: 'pcl/io/pcd_io.h': No such file or directory]
To be more precise about my problem, I need to include three PCL header files in order to run thisIterative Closest Point Tutorial
I've followed the following steps to include the PCL into my project:
Added the include directories to my project at the Project Properties/Configuration Properties/VC++ Directories/Include Directories field - here I specified the path to my PCL/include directory and to all 3rd party include directories (PCL/3rdParty)
Added the library directories on the same settings page (Library Directories field) - hereI specified the path to my PCL/lib directory and to all non-header-only 3rd party libs (Boost, Flann, VTK)
Chose the libs to be used in the linker. In Project Properties/Configuration Properties/Linker/Input/Additional Dependencies field. I added all the libs required. As I'm trying to run it in debug mode for now, I've picked the "_debug.lib" library files.
Finally, I've added the PCL/bin folder to my system path variable.
Does anyone know if I'm missing something configuration-wise?
I've seen several old posts about incompatibility between older Point Cloud Libraries and older versions of Visual Studio. As far as I understood, the new versions are supposed to work well together, but it's not the case for me.
Installing pcl is tough because there are dozens of dependencies used along with pcl software. But with with vcpkg,a command line package manager, the installation becomes just like a one liner command.
Use Microsoft vcpkg to build a static or dynamic library for your project automatically. All the dependencies like boost,tiff,openssl,flann,szip,etc will be downloaded and installed by itself. After installing vcpkg type the following on Powershell.
.\vcpkg install pcl:x64-windows-static
The link you referenced is 3-4 years old. At the time, any binary build of PCL for Visual Studio 2012 or later was not provided, and thus. PCL needed to be built with target VS. And every include/library directory of PCL and any related library have to be manually added to setup the IDE. Since PCL is a large-scale collection of libraries, this made it difficult for its users to setup VS.
Now early 2018, binary builds of PCL for VS 2015/2017 and more automatic way to setup VS (e.g., adding library/include directories) using CMake are provided. Thus, installing PCL and creating a VS project using PCL does not take more than 10 minutes. I think you'd better follow the recommended way rather than setting VS by yourself.
the previous answer use vcpkg is good,but is better to use:
.\vcpkg install pcl:x64-windows
It can let you have fewer problems.
A small note for anyone who has issues with the install listed above, occasionally an install will get corrupted and not work. I got:
LINK : fatal error LNK1201
on a build, and the solution for that is find the downloaded item. This will be located in the vcpkg/downloads/ directory. Delete the item that was having issues and try the install again.

how to install boost/asio.hpp library for C++ visual studio 2015

Hello I am trying to install this library for use in one of my visual studio projects.
I know I have to go to \project properties-linker-general-additional library Directories but once I get there I don't know what to do.
I am stuck here :
Here's a step-by-step tutorial for installing, (optionally) building, and referencing boost in Windows: http://www.boost.org/doc/libs/1_61_0/more/getting_started/windows.html#get-boost
Obtain a copy of boost and put it to a folder boost_root (name as you please). If you haven't done it already, the easiest way is to get a precompiled zip from boost
Find the directory where your boost binaries are located. It usually is under the lib subdirectory, ie boost_root\libs.
Under the Additional library directory of visual studio (the one you mention in your post), enter the full or relative path to the boost dll directory, ie path_to_boost_root\boost_root\libs

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.