I have no problem running your code. Therefore, I doubt that in your case there is a problem with the construction.
My boost is built this way (after going to the Boost source directory):
bootstrap.bat .\b2.exe toolset=msvc -j 2 --with-test release link=shared stage
Then you need to copy the DLLs under the \ lib scene somewhere along your path and add the appropriate Boost directories to your environment. For my command line environment I have (if you did something like set BOOST_ROOT=C:\src\boost_1_65_1 ):
set INCLUDE=%BOOST_ROOT%;%INCLUDE% set LIB=%BOOST_ROOT%\stage\lib;%LIB%
Then I can successfully compile the test code without any problems:
cl /EHsc /MD test.cpp .\test.exe
source share