How to add boost library 1_65 or 1_64 to Visual St

2019-04-07 03:42发布

问题:

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.

回答1:

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.