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

风流意气都作罢 提交于 2021-02-05 15:34:44

问题


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?


回答1:


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

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




回答2:


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:

  1. From your boost_X_XX_X directory, go to

    .\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. Add this directory to your PATH environment variable.

  3. Return to your boost_X_XX_X directory and type:

    bjam toolset=gcc
    

This worked for me on my system. I'd be interested to know if other systems have trouble with these instructions.




回答3:


However there would have been a simpler, yet identical way; your steps until the bjam call are automatically done by 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




回答4:


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

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

set PATH=%PATH%;c:\boost_1_59_0\tools\build\src\engine\bin.ntx86
bjam toolset=gcc


来源:https://stackoverflow.com/questions/7847454/how-do-i-install-the-boost-library-to-my-mingw-compiler

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!