I have an external c++ code base I am trying to build that requires BOOST. I have VS2015 community edition and am trying to build from the command line.
I downloaded and built boost using this command:
.\b2 toolset=msvc-14.0 --build-type=complete --abbreviate-paths architecture=64 address-model=64 install -j4
cl /EHsc -I "C:\Users\alex\Documents\boost_1_60_0" myproj_helper.cpp main.cpp /link /LIBPATH:"C:\Boost\lib" /out:program.exe
libboost_thread-vc140-mt-s-1_60.lib(thread.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
You are building Boost using the architecture
x64, which is good and what you want. The problem is that you're building your project with the default architecture of
x86 which conflicts with Boost when linking. Using this documentation, you can setup your environment in the command line to use the
Set the desired MSVC version's VC directory as the working directory.
cd "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
Run this magic batch script (there's also
amd64_x86 which is default, and
If you intended to build for
x86, you will just need to configure Boost to build to
x86. Like I said, this is the default for MSVC which will make it compatible.