如何在64位中构建Boost 1.64? [英] How to build Boost 1.64 in 64 bits?
问题描述
我正在运行Windows 10并在笔记本电脑中安装了Visual Studio 2017 Community Edition. 我有一些较旧的程序可以在VS 2015中用64位Boost 1.62.0很好地编译. 出于某些非常奇怪的原因,我无法找到一种方法,可以使用VS 2017通过以下命令行从Boost 1.64.0(这里为文件系统和计时器)编译任何库:
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 = .. \ build_here --with-filesystem --with-timer --address-model = 64
b2 --build-dir=..\build_here --with-filesystem --with-timer --address-model=64
该命令将执行,并且将构建库,但要使用32位!
The command will execute and the libraries will be built, but in 32 bits!!
出什么问题了?
关于, 胡安·登特
推荐答案
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.:
在Visual Studio工具命令提示符中:
In a Visual Studio tools Command Prompt:
cd boost_1_64_0
call bootstrap.bat
对于静态库(建议用于Windows):
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
注意:
Visual Studio 2017
的正确b2
工具集是msvc-14.1
不是msvc-15.0
和
Visual Studio 2019
的b2
工具集是msvc-14.2
.
如有疑问(并且您仅安装了Visual Studio的一个版本),只需使用toolset=msvc
.
Note: the correct
b2
toolset forVisual Studio 2017
ismsvc-14.1
notmsvc-15.0
and
theb2
toolset forVisual Studio 2019
ismsvc-14.2
.
If in doubt (and you've only one version of Visual Studio installed) just usetoolset=msvc
.
这篇关于如何在64位中构建Boost 1.64?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!