我运行的是 Windows 10,并在我的笔记本电脑中安装了 Visual Studio 2017 Community Edition.我有一些较旧的程序在 VS 2015 中使用 64 位 Boost 1.62.0 编译得很好.由于一些非常奇怪的原因,我找不到一种方法来编译 Boost 1.64.0(这里是文件系统和计时器)中的任何库,使用 VS 2017 和这个命令行:
<块引用>b2 --build-dir=..uild_here --with-filesystem --with-timer --address-model=64
将执行命令并构建库,但以 32 位为单位!!
可能出了什么问题?
问候,胡安·丹特
更新我给出的答案 此处.Visual Studio 2017
是一个新的工具集,因此只需将 toolset=msvc-14.0
(对于 Visual Studio 2015
)替换为 toolset=msvc-14.1
即:
在 Visual Studio 工具命令提示符中:
cd boost_1_64_0调用 bootstrap.bat
对于静态库(推荐用于 Windows):
b2 -j8 toolset=msvc-14.1 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=complete stage
注意:线程必须使用动态链接构建,参见:https://studiofreya.com/2015/05/20/the-simplest-way-of-building-boost-1-58-for-32-bit-and-64-bit-architectures-with-visual-studio/
在动态库中构建线程:
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
not msvc-15.0
和Visual Studio 2019
的 b2
工具集是 msvc-14.2
.
如果有疑问(并且您只安装了一个版本的 Visual Studio),只需使用 toolset=msvc
.
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
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 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!