如何使用 MinGW 构建 Boost 1.55?

2021-12-24 00:00:00 windows build mingw c++ boost

我已经下载了 Boost 1.55 和 MinGW.

I have downloaded Boost 1.55 and MinGW.

控制台回答我没有任何命令.我无法理解如何绑定两个路径并激活 GCC 编译器.

The console answers me that I haven't any command. I can't understand how to bind two paths and activate the GCC compiler.

P.S.:如果我使用 Microsoft 的编译器构建 boost,我将有大约 8 个错误,错误 3861!

P.S.: If I build boost with Microsoft's compiler I will have about 8 mistakes with error 3861!!

我该如何构建它?

推荐答案

首先确保你的 mingw 的 bin 目录在你的环境中 PATH 所以 gccg++ 可从命令提示符调用.然后进入你解压文件的boost根目录.

First make sure your mingw's bin directory is in your environment PATH so gcc and g++ is callable from your command prompt. Afterwards go into your boost's root directory of where you extracted the files.

按照引导程序 + b2.exe 进行构建.例如,假设您只想编译 boost 的正则表达式部分.以下命令应该可以解决问题:

Follow that with a bootstrap + b2.exe to build. For example, let's say you only want to compile the regex portion of boost. The follow commands should do the trick:

bootstrap gcc
b2 toolset=gcc regex

您可以使用:

b2 --show-libraries

获取您可以单独构建的模块列表.当然,您可以通过以下方式构建所有这些:

to get a listing of modules you can build individually. Of course you can build all of them with just:

b2 toolset=gcc

查看 Boost Invocation可用选项的详细列表.

Check out Boost Invocation for a detailed list of available options.

相关文章