C++ 适用于 64 位 Windows 的 64 位版本的 Boost
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2322255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
64-bit version of Boost for 64-bit windows
提问by ra170
Is there a version of 64-bit Boost library for VS2008 ? Or do I have to compile one myself? if, so, does anyone have experience with it?
是否有适用于 VS2008 的 64 位 Boost 库版本?还是我必须自己编译一个?如果是这样,有没有人有这方面的经验?
回答by Adrian Conlon
As a short answer:
作为一个简短的回答:
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete
As a longer answer, here are my build notes for having VS .NET 2008 32-bit and 64-bit boost libraries in the same hierarchy (which is I suspect a common use case):
作为更长的答案,这是我的构建说明,用于在同一层次结构中使用 VS .NET 2008 32 位和 64 位 boost 库(我怀疑这是一个常见用例):
Build the win32 binaries
bjam --toolset=msvc-9.0 --build-type=complete stage
Create the directory lib\win32
- Move the contents of stage\lib to lib\win32
- Remove the directories bin.v2 and stage
Build the x64 binaries
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
Create the directory lib\x64
- Move the contents of stage\lib to lib\x64
- Remove the directories bin.v2 and stage
构建 win32 二进制文件
bjam --toolset=msvc-9.0 --build-type=complete stage
创建目录lib\win32
- 将 stage\lib 的内容移动到 lib\win32
- 删除目录 bin.v2 和 stage
构建 x64 二进制文件
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
创建目录lib\x64
- 将 stage\lib 的内容移动到 lib\x64
- 删除目录 bin.v2 和 stage
回答by teeks99
I've got the built binaries on my site: http://boost.teeks99.com
我的网站上有内置的二进制文件:http: //boost.teeks99.com
Edit 2013-05-13: My builds are now available (starting from 1.53) directly from the sourceforge page.
编辑 2013-05-13:我的构建现在可以直接从sourceforge 页面获得(从 1.53 开始)。
回答by mtb
UPDATE(19.09.2017): added script lines for VS2017. Please be aware that Boost supports VS2017 compiler from a certain version above. I used the latest version (1.65.1).
更新(19.09.2017):为 VS2017 添加了脚本行。请注意,Boost 支持以上特定版本的 VS2017 编译器。我使用了最新版本 (1.65.1)。
I used this scripts for building boost for x64 and x86 platforms, lib and dll, debug and release for VS2017, VS2015 and VS2013:
我使用这个脚本为 x64 和 x86 平台构建 boost、lib 和 dll,调试和发布 VS2017、VS2015 和 VS2013:
md stage\VS2017\x64
md stage\VS2015\x64
md stage\VS2013\x64
b2 --stagedir=./stage/VS2017/x64 address-model=64 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2017/x64 address-model=64 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2015/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2015/x64 address-model=64 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2013/x64 address-model=64 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2013/x64 address-model=64 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=release
md stage\VS2017\win32
md stage\VS2015\win32
md stage\VS2013\win32
b2 --stagedir=./stage/VS2017/win32 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2017/win32 --build-type=complete --toolset=msvc-14.1 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2015/win32 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2015/win32 --build-type=complete --toolset=msvc-14.0 --threading=multi --runtime-link=shared --variant=release
b2 --stagedir=./stage/VS2013/win32 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=debug
b2 --stagedir=./stage/VS2013/win32 --build-type=complete --toolset=msvc-12.0 --threading=multi --runtime-link=shared --variant=release
pause
You can make a .bat
file and run it for building your boost binaries.
您可以创建一个.bat
文件并运行它来构建您的 boost 二进制文件。
回答by ecotax
At this moment, the 64-bits binaries provided by teeks99 (see other answer) appear to be the only free 64-bits binaries around. For a while, BoostPro also provided 64-bits binaries, but as of 1.51 they appear to be out or business.
此时,teeks99 提供的 64 位二进制文件(参见其他答案)似乎是唯一免费的 64 位二进制文件。有一段时间,BoostPro 还提供了 64 位二进制文件,但从 1.51 开始,它们似乎已经过时了。
So, there we're back to two options again: the teeks99 binaries, or building your own.
所以,我们又回到了两个选项:teeks99 二进制文件,或者构建您自己的。
Most of the information I needed to build my own was here: https://stackoverflow.com/a/2655683/613288
我自己构建所需的大部分信息都在这里:https: //stackoverflow.com/a/2655683/613288
The only thing missing was how to get this to work with the free version of Visual Studio 2010 Express. I found that missing part somewhere else, and after some customization the final recipe I used for my build of the boost 1.49.0 binaries was:
唯一缺少的是如何让它与 Visual Studio 2010 Express 的免费版本一起工作。我发现在其他地方缺少的部分,经过一些定制后,我用于构建 boost 1.49.0 二进制文件的最终配方是:
Start Visual C++, and from the Tools menu start Visual Studio Command Prompt.
启动 Visual C++,然后从工具菜单启动 Visual Studio 命令提示符。
In the console window, do the following:
在控制台窗口中,执行以下操作:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\setenv.cmd" /Release /x64
and then in the boost directory:
然后在boost目录中:
bootstrap.bat
b2 -a -sBZIP2_SOURCE="C:\bzip2-1.0.6" -sZLIB_SOURCE="C:\zlib-1.2.5" --toolset=msvc-10.0 architecture=x86 address-model=64 link=static --with-date_time --with-filesystem --with-serialization --with-test --with-thread --with-system --with-regex --with-iostreams stage
The last command is customized for what I happened to need (just some statically linked libraries).
最后一个命令是为我碰巧需要的东西定制的(只是一些静态链接的库)。
回答by Harald Krause
I made me a small script which compiles them all for VS2005 and VS2008:
我为 VS2005 和 VS2008 编写了一个小脚本,用于编译它们:
md stage\lib\win32
md stage\lib\x64
REM Visual Studio 2005
bjam --toolset=msvc-8.0 --build-type=complete stage
move /Y stage\lib\* stage\lib\win32\
bjam --toolset=msvc-8.0 address-model=64 --build-type=complete stage
move /Y stage\lib\* stage\lib\x64\
REM Visual Studio 2008
bjam --toolset=msvc-9.0 --build-type=complete stage
move /Y stage\lib\* stage\lib\win32\
bjam --toolset=msvc-9.0 address-model=64 --build-type=complete stage
move /Y stage\lib\* stage\lib\x64\