Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

c++ - How to build Boost 1.64 in 64 bits?

I am running Windows 10 and have Visual Studio 2017 Community Edition installed in my laptop. I have some older programs that compiled fine in VS 2015 with Boost 1.62.0 in 64 bits. For some very strange reason, I cannot find a way to compile say any library from Boost 1.64.0 (here filesystem and timer) using VS 2017 with this command line:

b2 --build-dir=..uild_here --with-filesystem --with-timer --address-model=64

The command will execute and the libraries will be built, but in 32 bits!!

What could be going wrong?

Regards, Juan Dent

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To update the answer I gave here. Visual Studio 2017 is a new toolset, so simply replace toolset=msvc-14.0 (for Visual Studio 2015) with toolset=msvc-14.1 i.e.:

In a Visual Studio tools Command Prompt:

cd boost_1_64_0
call bootstrap.bat

For static libraries (recommended for Windows):

b2 -j8 toolset=msvc-14.1 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=complete stage

Note: thread must be built with dynamic linking see: https://studiofreya.com/2015/05/20/the-simplest-way-of-building-boost-1-58-for-32-bit-and-64-bit-architectures-with-visual-studio/

To build thread in a dynamic library:

b2 -j8 toolset=msvc-14.1 address-model=64 architecture=x86 link=shared threading=multi runtime-link=shared --with-thread --build-type=minimal stage

Note: the correct b2 toolset for Visual Studio 2017 is msvc-14.1 not msvc-15.0 and
the b2 toolset for Visual Studio 2019 is msvc-14.2.
If in doubt (and you've only one version of Visual Studio installed) just use toolset=msvc.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...