Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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. 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 for building, i.e. C:\Program Files\boost_1_59_0\build.
  4. Create a folder for installation, e.g. C:\Program Files\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 C:\Program Files\boost_1_59_0\tools\build.
  2. Run 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 C:\Program Files\boost_1_59_0.
  2. Run
b2 --build-dir="C:\Program Files\boost_1_59_0\build" --prefix="C:\Program Files\boost" toolset=gcc install

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.a.
@okere-prince

This comment has been minimized.

Show comment
Hide comment
@okere-prince

okere-prince Mar 19, 2017

Thanks a lot for this nice and clear procedure.
It was really helpfull for me :). However it seems that the command bootstrap.bat mingw didn't work for me (I tried this with boost_1_63_0). I used bootstrap.bat gcc instead and it was fine.
Cheers

okere-prince commented Mar 19, 2017

Thanks a lot for this nice and clear procedure.
It was really helpfull for me :). However it seems that the command bootstrap.bat mingw didn't work for me (I tried this with boost_1_63_0). I used bootstrap.bat gcc instead and it was fine.
Cheers

@j4cobgarby

This comment has been minimized.

Show comment
Hide comment
@j4cobgarby

j4cobgarby Sep 4, 2017

I agree with okere-prince - the whole tutorial was very helpful except you should change bootstrap.bat mingw to boostrap.bat gcc, in fact mingw isn't even a valid toolset.

j4cobgarby commented Sep 4, 2017

I agree with okere-prince - the whole tutorial was very helpful except you should change bootstrap.bat mingw to boostrap.bat gcc, in fact mingw isn't even a valid toolset.

@andreoliveira31

This comment has been minimized.

Show comment
Hide comment
@andreoliveira31

andreoliveira31 Sep 4, 2017

I agree with both okere and j4cob, please update the tutorial.

andreoliveira31 commented Sep 4, 2017

I agree with both okere and j4cob, please update the tutorial.

@RafaelMH

This comment has been minimized.

Show comment
Hide comment
@RafaelMH

RafaelMH Sep 27, 2017

Thank you so much for this, I was starting to get desperate.

Also, as of boost 1.65.1 you should still change bootstrap.bat mingw to boostrap.bat gcc.

RafaelMH commented Sep 27, 2017

Thank you so much for this, I was starting to get desperate.

Also, as of boost 1.65.1 you should still change bootstrap.bat mingw to boostrap.bat gcc.

@Sk3pper

This comment has been minimized.

Show comment
Hide comment
@Sk3pper

Sk3pper Oct 1, 2017

I don't understand the last part, "Project setup". What have I to do? Where have I to add that folders (lib, include ecc)?

Sk3pper commented Oct 1, 2017

I don't understand the last part, "Project setup". What have I to do? Where have I to add that folders (lib, include ecc)?

@vitor-alves

This comment has been minimized.

Show comment
Hide comment
@vitor-alves

vitor-alves Oct 18, 2017

bootstrap.bat mingw worked for me in 1.65.1

vitor-alves commented Oct 18, 2017

bootstrap.bat mingw worked for me in 1.65.1

@BramVanroy

This comment has been minimized.

Show comment
Hide comment
@BramVanroy

BramVanroy Jul 6, 2018

I'm also confused about the last part. Could you elaborate on this? What should be linked and how.

BramVanroy commented Jul 6, 2018

I'm also confused about the last part. Could you elaborate on this? What should be linked and how.

@andyspurgeon

This comment has been minimized.

Show comment
Hide comment
@andyspurgeon

andyspurgeon Jul 13, 2018

Just a note that for Boost 1.67.0, I had to go back to bootstrap.bat gcc instead of mingw. Not sure if that's something in the Boost build system or my setup, but it worked.

@BramVanroy, the project setup depends on what you are developing using Boost. Boost is composed of multiple libraries. So, you typically don't include/link all of Boost -- you only use what you need. See this link for a list of the individual Boost libraries.

andyspurgeon commented Jul 13, 2018

Just a note that for Boost 1.67.0, I had to go back to bootstrap.bat gcc instead of mingw. Not sure if that's something in the Boost build system or my setup, but it worked.

@BramVanroy, the project setup depends on what you are developing using Boost. Boost is composed of multiple libraries. So, you typically don't include/link all of Boost -- you only use what you need. See this link for a list of the individual Boost libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment