Skip to content

Instantly share code, notes, and snippets.

@bhaskar253
Forked from sim642/boost-windows.md
Last active July 10, 2020 01:47
Show Gist options
  • Select an option

  • Save bhaskar253/34cf271457da022b1f0b4650da555762 to your computer and use it in GitHub Desktop.

Select an option

Save bhaskar253/34cf271457da022b1f0b4650da555762 to your computer and use it in GitHub Desktop.
Installing boost libraries for GCC (MinGW) on Windows

Installing boost libraries for GCC (MinGW) on Windows

Folder setup

  1. Extract downloaded boost source, e.g. F:\boost_1_67_0.
  2. Create a folder for Boost.Build installation, e.g. F:\boost-build.
  3. Create a folder within for building, i.e. F:\boost_1_67_0\build.
  4. Create a folder for installation, e.g. F:\boost.

GCC setup

  1. Open Command Prompt.
  2. Run g++ --version.
  3. If the output contains g++ version number then GCC should be set up properly to run from command line and you can continue.

Boost.Build setup

  1. Open Command Prompt and navigate to F:\boost_1_67_0\tools\build.
  2. Run bootstrap.bat gcc.
  3. Run b2 install --prefix="F:\boost-build".
  4. Add F:\boost-build\bin to Windows PATH.

boost building

  1. Open Command Prompt and navigate to F:\boost_1_67_0.
  2. Run
b2 --build-dir="F:\boost_1_67_0\build" --prefix="F:\boost" toolset=gcc install -jX

replace X by [2 or 4 or 8] based on your cpu-core to speed up things.

Project setup

  1. Add include folder, i.e. F:\boost\include\boost-1_67.
  2. Add linker folder, i.e. F:\boost\lib.
  3. Link required libraries, e.g. libboost_regex-mgw81-mt-d-x32-1_67.a.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment