Skip to content

Instantly share code, notes, and snippets.

@ahmednawazkhan
Last active September 7, 2023 04:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmednawazkhan/1c347720af344ee911144ab9f89a1e26 to your computer and use it in GitHub Desktop.
Save ahmednawazkhan/1c347720af344ee911144ab9f89a1e26 to your computer and use it in GitHub Desktop.
Installing C++ Boost Libraries on Windows

Installing C++ Boost Libraries on Windows using MSYS2

  1. Download boost from https://www.boost.org/users/download/
  2. Extract the contents to /c/downloads/boost_1_77_0
  3. Create a folder within for building. /c/downloads/boost_1_77_0/build
  4. Create a folder for Boost Build installation /c/downloads/boost-build
  5. Create a folder for installation /c/libs/boost
  6. Make sure g++ --version is successfuly running
  7. Open Msys2 Mingw 64-bit with administrative rights
  8. Navigate to /c/downloads/boost_1_77_0/tools/build
  9. Run ./bootstrap.bat mingw
  10. Run ./b2 install --prefix="/c/downloads/boost-build"
  11. Add /c/downloads/boost-build/bin to Windows PATH.
  12. In order for msys2 to have windows environment variables, add MSYS2_PATH_TYPE=inherit variable to windows environment.
  13. Close Msys2 and restart using administrative rights
  14. Verify that you can access b2 and windows env variables are picked up by Msys2
  15. Navigate to /c/downloads/boost_1_77_0
  16. Run b2 --build-dir="/c/downloads/boost_1_77_0/build" --prefix="/c/libs/boost" toolset=gcc install
  17. After Installation is complete go to your project and go to its build folder
  18. Run cmake -DBoost_ROOT="/c/libs/boost" path_to_cmakelist
  19. Add Boost_ROOT to windows env varaibles to run cmake without passing Boost_ROOT param.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment