Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add boost library 1_65 or 1_64 to Visual Studio 2017 project?

I am trying to add boost 1_64 (boost 1_65 will also work) to my Visual Studio 2017 project which includes boost/array.hpp and boost/asio.hpp and used various methods of the same.

I have used the following method https://studiofreya.com/2017/04/23/building-boost-1-64-with-visual-studio-2017/ but I am getting error: cannot open source file "boost/array.hpp" and cannot open source file "boost/asio.hpp" and other errors on the methods of boost.

like image 347
Atul Kumar Avatar asked Aug 31 '17 05:08

Atul Kumar


People also ask

How do I link my Boost library to Visual Studio?

6.1 Link From Within the Visual Studio IDE Right-click example in the Solution Explorer pane and select Properties from the resulting pop-up menu. In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:\Program Files\boost\boost_1_55_0\lib\.

How do I add a Boost library?

Go to Project properties → C/C++ → General → Additional Include Directories, and add a path to the boost library root (in my case C:\Program Files (x86)\Boost_1_53 ). Include a . hpp file in your sources, like #include <boost/lexical_cast/lexical_cast_old. hpp>

How do you add Boost to a project?

Create a Boost.In the Add New Item dialog, expand Installed > Visual C++ > Test. Select Boost. Test, then choose Add to add Test. cpp to your project.

Where do Boost libraries install?

Install Boost (Windows) Download the source code from http://www.boost.org/users/download/. Extract in a Boost folder located at C:\ or C:\Program files so that CMake find-modules can detect it. Invoke the command line and navigate to the extracted folder (e.g. cd C:\Boost\boost_1_63_0 ).


1 Answers

The error implies that you haven't added boost to the VC++ Directories.
To add them:

  • Open the Property Manager from the View -> Other Windows menu.

  • Click on the project and navigate down to Microsoft.Cpp.x64.user.

  • Right click and select Properties.

  • Open Common Properties and select VC++ Directories

  • Add the directory where you installed boost to Include Directories

  • Add the directory where you builtboost libraries to Library Directories

Also see Boost Getting Started on Windows in case you get stuck elsewhere.

like image 115
kenba Avatar answered Oct 13 '22 20:10

kenba