Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.
Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow
Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the boost_1_68_0.zip source from Sourceforge
Note: This should work perfectly with other versions of boost as well
Copy these to a new folder
C:\install
It should now contain the following two files
mingw-w64-install.exe
boost_1_68_0.zip
Run mingw-w64-install.exe
Click next
Change the Architecture from i868
to x86_64
Click next and keep the default install location
Click next to start the install
Click Finish to exit the installer
Open a command prompt AS ADMIN
- windows key -> type "cmd"
- right click "command prompt"
- Run as administrator
Enter the following command to create a link to MinGW folder in C:\
mklink /J C:\MinGW "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64"
Add this to the session and system PATH environment variable
set PATH=%PATH%;C:\MinGW\bin
setx /M PATH "%PATH%"
Check to ensure proper install
g++ --version
should return the following info
cd C:\install
powershell -command "Expand-Archive C:\install\boost_1_68_0.zip C:\install"
This takes about 15 minutes
cd C:\install\boost_1_68_0
mkdir C:\boost-build
mkdir C:\install\boost_1_68_0\boost-build
mkdir C:\boost
cd C:\install\boost_1_68_0\tools\build
prepare b2
bootstrap.bat gcc
Build boost.build with b2
b2 --prefix="C:\boost-build" install
Add C:\boost-build\bin to your session PATH variable
set PATH=%PATH%;C:\boost-build\bin
navigate back up to the boost unzipped root directory
cd C:\install\boost_1_68_0
Build boost with b2
b2 --build-dir="C:\install\boost_1_68_0\build" --build-type=complete --prefix="C:\boost" toolset=gcc install
This is going to take awhile, so try to run this command right before beginning the director's cut of Lord of the Ring Return of the King.
When this is done you should see the following output
You can now delete "C:\install" and "C:\boost-build"
Everything should now be installed
Include folder:
C:\boost\include\boost-1_68
Linker folder:
C:\boost\lib
Link required libraries:
e.g. libboost_atomic-mgw81-mt-d-x64-1_68.a
You won't need to build, a prebuilt library will be made available to you via MSYS2. :) That's how I did it too.