- Extract downloaded boost source, e.g.
C:\Program Files\boost_1_59_0
. - Create a folder for Boost.Build installation, e.g.
C:\Program Files\boost-build
. - Create a folder within for building, i.e.
C:\Program Files\boost_1_59_0\build
. - Create a folder for installation, e.g.
C:\Program Files\boost
.
- Open Command Prompt.
- Run
g++ --version
. - If the output contains g++ version number then GCC should be set up properly to run from command line and you can continue.
- Open Command Prompt and navigate to
C:\Program Files\boost_1_59_0\tools\build
. - Run
bootstrap.bat mingw
. - Run
b2 install --prefix="C:\Program Files\boost-build"
. - Add
C:\Program Files\boost-build\bin
to Windows PATH.
- Open Command Prompt and navigate to
C:\Program Files\boost_1_59_0
. - Run
b2 --build-dir="C:\Program Files\boost_1_59_0\build" --prefix="C:\Program Files\boost" toolset=gcc install
- Add include folder, i.e.
C:\Program Files\boost\include\boost-1_59
. - Add linker folder, i.e.
C:\Program Files\boost\lib
. - Link required libraries, e.g.
libboost_regex-mgw48-mt-1_59.a
.
Hello guys :)
I tried to do this instruction and get the error while compiling:
C:/Develop/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibboost_unit_test_framework-mgw73-mt-x64-1_71.a
My instruction at Makefile:
all:
g++ -o test test/Test.cpp -I C:/Develop/boost/include/boost-1_71 -L C:/Develop/boost/lib -llibboost_unit_test_framework-mgw73-mt-x64-1_71.a
Test.cpp file:
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Hello
#include <boost/test/unit_test.hpp>
int add( int i, int j )
{
return i + j;
}
BOOST_AUTO_TEST_CASE( testAdd )
{
BOOST_CHECK( add( 2, 2 ) == 4 );
}
Any suggestion? I fight with this a lot of time. I use MinGW 7.3.0 and Visual Studio Code on Windows