boost 库在windows 系统下,gcc编译器编译

来源:互联网 发布:pkpm软件分类 编辑:程序博客网 时间:2024/05/16 07:38

  我下载了boost库,按百度搜索的编译方法,好像不行。

        耐心看boost的说明 进行编译,通过了。

    大部分的boost不需要编译,只要引入头相应文件即可,只有少部分库需要编译

   1.下载boost库 http:// www.boost.or  下下载  boost_1_53_0.7z 文件,解压,其根目录下有一个 index.htm 文件,有关于编译的详细说明。

          在windows 下的编译看  Getting Started on Windows 连接。

  2   生成 Boost.Build 工具       

        进入目录  tools\build\v2\.

        运行 脚本 bootstrap.bat,生成b2.exe文件

        在命令行模式下运行:

                b2 install --prefix=PREFIX 

                PREFIX is the directory where you want Boost.Build to be installed

                Add PREFIX\bin to your PATH environment variable. 

3  Change your current directory to the Boost root directory and invoke b2 as follows: 

b2 --build-dir=build-directory toolset=toolset-name --build-type=complete stage

      具体的 b2 命令执行有许多参数和语法,具体参考文档。

  例如:编译regx库,生成共享库,命令行如下

 最后编译成功 :



补充: 我的计算机重装后,装好GCC,按照上面步骤:          

        进入目录  tools\build\v2\.

        运行 脚本 bootstrap.bat

发现错误:

Bootstrapping the build engine

Failed to bootstrap the build engine

Please consult bootstrap.log for furter diagnostics.

打开bootstrap.log文件发现提示

  ### "Could not find a suitable toolset."
###
### You can specify the toolset as the argument, i.e.:
###     .\build.bat msvc
###
### Toolsets supported by this script are: borland, como, gcc, gcc-nocygwin,
###     intel-win32, metrowerks, mingw, msvc, vc7, vc8, vc9, vc10, vc11

原来我的机器未装VC开发环境,而GCC工具集又未检测出来,要输入参数才行

  执行命令    bootstrap.bat  gcc           (后面加了gcc参数) 正常



  

原创粉丝点击