windows 如何获取适用于 Visual Studio 的 Boost 库二进制文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2049952/
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
How to get Boost libraries binaries that work with Visual Studio?
提问by teeks99
Here's a question you may have seen around the 'nets in various forms...summed up here for you googling pleasure :-)
这是您可能在各种形式的“网”周围看到的一个问题......在这里总结一下,让您在谷歌上搜索快乐:-)
I have a project that is built with Microsoft's Visual Studio and uses functionality from boost (http://www.boost.org/). I already have my project working with some of the libraries that are header only (no binary library needed to link with). How or where can I get the windows binaries for the other libraries?
我有一个使用 Microsoft 的 Visual Studio 构建并使用 boost ( http://www.boost.org/) 功能的项目。我已经让我的项目使用了一些只有头文件的库(不需要链接的二进制库)。我如何或在哪里可以获得其他库的 Windows 二进制文件?
回答by teeks99
There are three different options for accessing the binary libraries:
访问二进制库有三种不同的选项:
1) Build them from source.
Go into the boost directory and run:
1)从源代码构建它们。
进入 boost 目录并运行:
bootstrap
.\bjam
Or get more complicate and do something like:
或者变得更复杂并执行以下操作:
bjam --stagedir="c:\Program Files\Boost" --build-type=complete --toolset=msvc-9.0 --with-regex --with-date_time --with-thread --with-signals --with-system --with-filesystem --with-program_options stage
2) Use the BoostPro installer (http://www.boostpro.com/download) to get the specific libraries that you need.
This is very nice because it only downloads and installs the files that you say you want. However, it never has the most current version available, and there are no 64 bit binaries.
2) 使用 BoostPro 安装程序 ( http://www.boostpro.com/download) 获取您需要的特定库。
这非常好,因为它只下载和安装您说需要的文件。但是,它从来没有可用的最新版本,也没有 64 位二进制文件。
3) Download the entire set of libraries (http://boost.teeks99.com)
Easy to use, simple to do, but the libraries are huge (7GB unzipped!).
Edit 2013-05-13: My builds are now available (starting from 1.53) directly from the sourceforge page.
3) 下载整套库 ( http://boost.teeks99.com)
易于使用,操作简单,但库很大(解压后为 7GB!)。
编辑 2013-05-13:我的构建现在可以直接从sourceforge 页面获得(从 1.53 开始)。
回答by denfromufa
conda-forge (automated cross-platform cloud build tool and package manager) provides binaries for all major platforms:
conda-forge(自动跨平台云构建工具和包管理器)为所有主要平台提供二进制文件:
https://anaconda.org/conda-forge/boost
https://anaconda.org/conda-forge/boost
You can now get Boost binaries from:
您现在可以从以下位置获取 Boost 二进制文件:
http://sourceforge.net/projects/boost/files/boost-binaries/
http://sourceforge.net/projects/boost/files/boost-binaries/
However they do not specify whether it is release or debug version.
但是他们没有指定它是发布版还是调试版。
回答by AndyUK
I used to prefer using BoostProto install the Boost libraries that needed separate compilation, such as Boost.Regex, but alas this no longer seems to be supported.
我以前更喜欢使用BoostPro来安装需要单独编译的 Boost 库,例如 Boost.Regex,但可惜现在似乎不再支持了。
Go to the Boost Getting Started for Windowspage, it tells you pretty much everything you need to know in section 5.2.1. Here is a simple guide(with screenshots) that shows you how to get started.
转到Boost Getting Started for Windows页面,它在第 5.2.1 节中告诉您几乎所有需要了解的信息。这是一个简单的指南(带有屏幕截图),向您展示如何开始。
To summarize, from the command prompt you need to run the following commands:
总而言之,您需要从命令提示符运行以下命令:
> boostrap.bat
> .\b2
Running the .\b2 command can take quite some time.
运行 .\b2 命令可能需要相当长的时间。
And then in your Visual Studio project properties, you'll need to:
然后在你的 Visual Studio 项目属性中,你需要:
- Select the C/C++ > General tab and set the Additional Include Directories field
- Select the Linker > General tab and set the Additional Library Directories field.
- 选择 C/C++ > General 选项卡并设置 Additional Include Directories 字段
- 选择链接器 > 常规选项卡并设置附加库目录字段。
For step 2, this is typically the stage\lib directory of your Boost root directory.
对于第 2 步,这通常是 Boost 根目录的 stage\lib 目录。
回答by Roel
Build them yourself. Download a bjam executable from the boost website, then execute the following command from the boost src root directory:
自己建造它们。从 boost 网站下载一个 bjam 可执行文件,然后从 boost src 根目录执行以下命令:
bjam --toolset=msvc --build-type=complete define=_BIND_TO_CURRENT_MFC_VERSION=1 define=_BIND_TO_CURRENT_CRT_VERSION=1 stage
bjam --toolset=msvc --build-type=complete define=_BIND_TO_CURRENT_MFC_VERSION=1 define=_BIND_TO_CURRENT_CRT_VERSION=1 阶段
Then go get some coffee or leave it running over night. After that you get results in the 'stage' folder. Add this directory to your 'library files' in options->projects and solutions->VC++ directories.
然后去喝杯咖啡或让它运行一夜。之后,您将在“舞台”文件夹中获得结果。将此目录添加到选项-> 项目和解决方案-> VC++ 目录中的“库文件”。
回答by physincubus
1) navigate to boost directory
1)导航到boost目录
2) run bootstrap - note: bjam doesn't appear to work at this point, but maybe i did something wrong
2)运行引导程序 - 注意:此时 bjam 似乎不起作用,但也许我做错了什么
3) run .\b2 this should set up boost defaulting to what it detects as your primary, or maybe most recent windows toolset, so for me this is msvc11.0
3) 运行 .\b2 这应该将 boost 默认设置为它检测到的主要工具集,或者可能是最新的 Windows 工具集,所以对我来说这是 msvc11.0
then you wait a while, and voila!
然后你等一会儿,瞧!
as the above says, just include the directories of the boost libs (D:\boost_1_5x_x\stage\lib) and includes that you use in the respective Additional Directories fields. You do not need to necessarily do this from "C/C++" or "Linker". there is a heading VC++ that has all of the relevant fields there. you can also, if you are regularly using boost, include them in the inherited directories listing
如上所述,只需包含 boost 库的目录 (D:\boost_1_5x_x\stage\lib) 并包含您在相应附加目录字段中使用的目录。您不一定需要从“C/C++”或“链接器”执行此操作。有一个标题 VC++,其中包含所有相关字段。如果您经常使用 boost,您也可以将它们包含在继承的目录列表中
**edit: only just realized that the post above outlines this. very sorry.
**编辑:刚刚意识到上面的帖子概述了这一点。很抱歉。