Windows 下利用QT编译boost_1_53_0

Windows 下利用QT编译boost_1_53_0

一、下载源码

在boost官网下载源代码

找到指定的版本。

一、编译源代码

将源代码解压后,用CMD命令进入到源代码根目录

利用CMD命令如下: bootstrap gcc

此命令会在Boost根目录下生成b2.exe等必要的编译工具

  • 开始编译和安装

    bash

    b2 install --toolset=gcc --build-type=complete threading=multi link=static address-model=64 --prefix="D:\path\to\boost_build"
    • --toolset=gcc关键参数,指定使用MinGW的GCC编译器。

    • --build-type=complete:同时编译Debug和Release版本。

    • threading=multi:支持多线程。

    • link=static:编译为静态库(.a文件)。如需要动态库(.dll),可改为link=shared

    • address-model=64:生成64位库。如果需要32位库,改为address-model=32

    • --prefix="D:\path\to\boost_build"推荐指定输出目录,方便管理。如果不指定,库文件会默认安装到C盘根目录。

编译过程耗时较长,请耐心等待