Skip to content

Instantly share code, notes, and snippets.

@RameshKamath
Forked from sim642/boost-windows.md
Last active May 13, 2020 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RameshKamath/1fa22511da947676055d3dc6350646f2 to your computer and use it in GitHub Desktop.
Save RameshKamath/1fa22511da947676055d3dc6350646f2 to your computer and use it in GitHub Desktop.
Installing boost libraries for GCC (MinGW) on Windows

Installing boost libraries for Windows

Folder setup

  1. Extract downloaded Boost Source, e.g. C:\Program Files\boost_1_59_0.
  2. Create a folder for Boost.Build installation, e.g. C:\Program Files\boost-build.
  3. Create a folder within boost source for building, i.e. C:\Program Files\boost_1_59_0\build.
  4. Create a folder as Boost Binary location for installation, e.g. C:\Program Files\boost.

Compiler Setup

  1. Open Command prompt/Terminal.
  2. Make sure that you have a C++ compiler and it can be called from Command prompt/Terminal.

Boost.Build setup

  1. Open Command Prompt and navigate to C:\Program Files\boost_1_59_0\tools\build.
  2. Run bootstrap.bat. Note: bootstrap.bat can take toolset flag as varible to set specific toolset. e.g. bootstrap.bat mingw
  3. Run b2 install --prefix="C:\Program Files\boost-build".
  4. Add C:\Program Files\boost-build\bin to Windows PATH.

boost building

  1. Open Command Prompt and navigate to boost source location C:\Program Files\boost_1_59_0.
  2. Run below to build boost with <select toolset> as toolset for building.
b2 --build-dir="C:\Program Files\boost_1_59_0\build" --prefix="C:\Program Files\boost" toolset=<select toolset> install
  1. Run below to find help
b2 --help

Project setup

  1. Add include folder, i.e. C:\Program Files\boost\include\boost-1_59.
  2. Add linker folder, i.e. C:\Program Files\boost\lib.
  3. Link required libraries, e.g. libboost_regex-mgw48-mt-1_59.lib.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment