简体   繁体   English

如何将boost库安装到我的MinGW编译器?

[英]How do I install the boost library to my MinGW compiler?

I'm compiling from the command line using g++ on a Windows MinGW installation. 我是在Windows MinGW安装中使用g ++从命令行编译的。 How do I get boost...conceptually or if it is easy...what do I need to download and install? 我如何从概念上获得提升......或者如果它很容易......我需要下载和安装什么?

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 (eg boost thread, boost regex etc) which I beleive you're asking for 这个页面上的最新发行版提升了1_52_0(这是我在写这篇文章时在boost网站上的最新版本),包括单独编译的库(例如boost thread,boost regex等),我相信你要求的

I spent hours searching for a good solution for Boost 1.54. 我花了几个小时为Boost 1.54寻找一个好的解决方案。 If you already have MinGW and you're just looking for instructions on compiling the binary boost libraries, try this: 如果您已经有MinGW并且您只是在寻找有关编译二进制增强库的说明,请尝试以下操作:

  1. From your boost_X_XX_X directory, go to 从您的boost_X_XX_X目录转到

     .\\tools\\build\\src\\engine 

    and type: 并输入:

     build.bat mingw 
  2. This will create a folder called bin.ntx86 or bin.ntx86_64 depending on your architecture. 这将创建一个名为bin.ntx86bin.ntx86_64的文件夹,具体取决于您的体系结构。 Add this directory to your PATH environment variable. 将此目录添加到PATH环境变量中。

  3. Return to your boost_X_XX_X directory and type: 返回你的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. 我有兴趣知道其他系统是否有这些说明的问题。

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 参考: https//stackoverflow.com/a/13257930/2171309

Thanx to Neal Kruis. Thanx到Neal Kruis。 This worked for me. 这对我有用。 I have Qt 5.4 with mingw 4.9 installed. 我安装了mingw 4.9的Qt 5.4。 I downloaded boost 1.59. 我下载了boost 1.59。 Go to "...\\boost_1_59_0\\tools\\build\\src\\engine\\" folder 转到“... \\ 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM