C++ 如何将 boost 库安装到我的 MinGW 编译器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7847454/
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 do I install the boost library to my MinGW compiler?
提问by woosah
I'm compiling from the command line using g++ on a Windows MinGW installation. How do I get boost...conceptually or if it is easy...what do I need to download and install?
我正在 Windows MinGW 安装上使用 g++ 从命令行编译。我如何获得提升...概念上或者如果它很容易...我需要下载和安装什么?
回答by woosah
I know this is an old question but for future reference for anybody coming to this page try this website, http://nuwen.net/mingw.html
我知道这是一个老问题,但为了将来访问此页面的任何人的参考,请尝试此网站, http://nuwen.net/mingw.html
They have done all the hard work so you don't have to. The most recent distribution on this page has boost 1_52_0 (which is the latest version on the boost website as I'm writing this) including the separately compiled libraries (e.g. boost thread, boost regex etc) which I beleive you're asking for
他们已经完成了所有艰苦的工作,因此您不必这样做。此页面上的最新发行版具有 boost 1_52_0(这是我撰写本文时在 boost 网站上的最新版本),包括我相信您要的单独编译的库(例如 boost 线程、boost regex 等)
回答by Neal Kruis
I spent hours searching for a good solution for Boost 1.54. If you already have MinGW and you're just looking for instructions on compiling the binary boost libraries, try this:
我花了几个小时为 Boost 1.54 寻找一个好的解决方案。如果您已经拥有 MinGW 并且您只是在寻找有关编译二进制 boost 库的说明,请尝试以下操作:
From your boost_X_XX_X directory, go to
.\tools\build\src\engine
and type:
build.bat mingw
This will create a folder called
bin.ntx86
orbin.ntx86_64
depending on your architecture. Add this directory to your PATH environment variable.Return to your boost_X_XX_X directory and type:
bjam toolset=gcc
从 boost_X_XX_X 目录,转到
.\tools\build\src\engine
并输入:
build.bat mingw
这将创建一个名为
bin.ntx86
或的文件夹,bin.ntx86_64
具体取决于您的架构。将此目录添加到 PATH 环境变量中。返回到您的 boost_X_XX_X 目录并键入:
bjam toolset=gcc
This worked for me on my system. I'd be interested to know if other systems have trouble with these instructions.
这在我的系统上对我有用。我很想知道其他系统是否对这些说明有问题。
回答by Victor Lellis
However there would have been a simpler, yet identical way; your steps until the bjam call are automatically done by bootstrap.bat:
然而,会有一种更简单但相同的方式;在 bjam 调用之前的步骤由 bootstrap.bat 自动完成:
C:\boost_1_52_0> bootstrap.bat mingw
Building Boost.Build engine
...
C:\boost_1_52_0> b2 toolset=gcc
Reference: https://stackoverflow.com/a/13257930/2171309
回答by Zibarov Volodymyr
Thanx to Neal Kruis. This worked for me. I have Qt 5.4 with mingw 4.9 installed. I downloaded boost 1.59. Go to "...\boost_1_59_0\tools\build\src\engine\" folder
感谢尼尔·克鲁斯。这对我有用。我有安装了 mingw 4.9 的 Qt 5.4。我下载了 boost 1.59。转到“...\boost_1_59_0\tools\build\src\engine\”文件夹
set PATH=%PATH%;c:\Qt\Qt5.4.0\Tools\mingw491_32\bin
build.bat mingw
go to "...\boost_1_59_0\" folder, change boost path accordingly
转到“...\boost_1_59_0\”文件夹,相应地更改提升路径
set PATH=%PATH%;c:\boost_1_59_0\tools\build\src\engine\bin.ntx86
bjam toolset=gcc