Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ boost nuget cannot open file Visual Studio 2015

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?

like image 348
pete Avatar asked Jan 29 '23 02:01

pete


2 Answers

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.

enter image description here

Hope this helps.

like image 199
Leo Liu-MSFT Avatar answered Jan 31 '23 17:01

Leo Liu-MSFT


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.

like image 37
SoronelHaetir Avatar answered Jan 31 '23 17:01

SoronelHaetir