How to use Boost in Visual Studio 2017

By , last updated July 17, 2019

After installing one of the versions of the C++ Boost library you need to know how to use it in VS2017. Remember, only Boost 1.64 and up works with Visual Studio 2017.

Property sheets

As for any of the previous versions of Boost (1.63 and down) the best way of using Boost with Visual Studio is to use property sheets.

Here is a property sheet for Boost version 1.64 for VS17:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros">
  <PropertyGroup />
  <ItemGroup />

Save the property sheet in a file called boost_current.props. Don’t save the version of boost in the filename. By using a generic name for the property sheet, it’s easier to edit the property sheet itself for the next version of boost.

Another thing to remember. In the recent versions of Visual Studio, the default platform for 32-bit code is x86, not Win32. If you are using x86 as the platform for 32-bit code, then the libraries must be in stage/x86. The build script can be edited so this happens automatically.

Add an existing property sheet to VS2017

We have property sheets for several versions of the C++ Boost library at our Studiofreya Github page (.props files).

Open the property manager.

Add existing property sheet (the one you saved in the previous step).

Verify the property sheet is added for all configurations.

Use Boost in project files

The other “inferior” way is to add the Boost include and library paths to the project files itself. While this is quick and dirty, and gets the job done, it will make upgrading Boost a pain later. For solutions having many projects, all projects must reference the same installation of Boost. And all projects can have many configurations and architectures. Open properties for the project, and add include and library paths to your Boost installation.

Use the comment section if there are any questions.