使用QT环境Mingw64编译Boost库(GCC)

1、首先得拿到QT creator,Boost,下载链接:

qt-opensource-windows-x86-5.13.0.exe:

http://download.qt.io/archive/qt/5.13/5.13.0/qt-opensource-windows-x86-5.13.0.exe

boost_1_71_0.zip:

https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.zip

2、安装完QT后,其自带的mingw编译器目录如下:

使用QT环境Mingw64编译Boost库(GCC)_第1张图片

将此目录添加至系统环境变量path中,如下:

使用QT环境Mingw64编译Boost库(GCC)_第2张图片

打开cmd,测试gcc -v,可以找到gcc。

使用QT环境Mingw64编译Boost库(GCC)_第3张图片

3、编译boost

(1)解压boost_1_71_0.zip,cmd中输入cd /d D:\boost_1_71_0\boost_1_71_0,进入解压后目录。

使用QT环境Mingw64编译Boost库(GCC)_第4张图片

(2)输入bootstrap gcc,表示使用“gcc”工具集(即我们安装的64位Mingw)生成编译工具“b2”

会在boost根目录生成 b2.exe  、project-config.jam 、bootstrap.log三个文件

使用QT环境Mingw64编译Boost库(GCC)_第5张图片

(3)编译并安装boost,输入b2 install --build-type=complete threading=multi link=shared address-model=64 toolset=gcc

stage表示只生成库(dll和lib),install还会生成包含头文件的include目录

--build-type=complete表示同时生成Debug和Release版本;

 threading=multi表示线程方式使用“multi ”(多线程)

link=shared表示链接方式使用“shared”(即构建动态库),“static”表示编译成静态库;

address-model=64表示地址模型使用64位(即生成的库均为64位库)

toolset=gcc表示工具集使用“gcc”

使用QT环境Mingw64编译Boost库(GCC)_第6张图片

(4)编译完成后,会在C:\Boost生成头文件和lib。

使用QT环境Mingw64编译Boost库(GCC)_第7张图片

使用时需要包含的头文件目录为C:\Boost\include\boost-1_71

使用QT环境Mingw64编译Boost库(GCC)_第8张图片

 

 

需要包含的lib目录为C:\Boost\lib

使用QT环境Mingw64编译Boost库(GCC)_第9张图片

 

===================================================

===================================================

他来了,他来了,他带着礼物走来了

你可能感兴趣的:(Boost)