• Compile boost with MSVC90


    boost C++库的绝大多数库并不需要编译,应用程序仅仅需要包含相应的头文件即可。但是部分boost库需要编译后使用。

    编译环境:

    • Windows XP
    • Visual Studio 2008 SP1

    目录清单:

    • BoostSrcDir,boost源代码的目录,放解压后的boost源代码及文档,例如D:\devroot\tools\boost\1_38_0
    • BoostInstallDir,boost编译后安装的目录,内含头文件和编译后的库文件(.lib和.dll),例如D:\devroot\tools\boost\1.38.0
    • BoostTempDir,boost编译中使用的临时目录,例如D:\devroot\tools\boost\temp

    步骤:

    1. 下载boost 1.38.0的源代码包(sourceforge.net的链接)并解压到%BoostSrcDir%
    2. 编译boost的跨平台build工具bjam
      1. 启动VS2008控制台(启动菜单>Microsoft Visual Studio 2008>Visual Studio Tools>Visual Studio 2008 Command Prompt),运行
        cd %BoostSrcDir%\tools\jam
        build_dist.bat
      2. 然后得到%BoostSrcDir%\tools\jam\stage\bin.ntx86\bjam.exe
    3. 编译boost库
      1. 在VS2008控制台里,运行
        cd %BoostSrcDir%
        %BoostSrcDir%\tools\jam\stage\bin.ntx86\bjam.exe -q --build-type=complete --build-dir=%BoostTempDir% --without-graph --without-math --without-mpi --without-python --without-signals --without-wave --prefix=%BoostInstallDir% install

        其中,
        -q 使得编译如果有失败立刻结束
        --build-type=complete 使得编译生成所有各种静动态、运行时组合
        --without-xxx 让编译跳过我不使用的库(可以用bjam --show-libraries列出所有可以生成lib的库)
      2. 然后%BoostInstallDir%里得到了编译后头文件和库文件。大功告成,我们可以删除%BoostTempDir%,在使用boost 的项目里只要把%BoostInstallDir%\include\boost-1_38和%BoostInstallDir%\lib分别加到 include和lib的搜索路径里。
        ├─include
        │  └─boost-1_38
        │      └─boost
        │          ├─accumulators
        │          ├─algorithm
        │          ├─archive
        └─lib
  • 相关阅读:
    使用vimdiff作为svn diff的查看代码工具
    Source Insight :在 { 后敲回车后让代码自动缩进
    关于浏览器内核的一些小知识
    Linux内存点滴 用户进程内存空间
    自定义eclipse代码模板
    sqlplus 小记
    LD_PRELOAD的用法 以及链接库的用法
    如何更方便的使用sooset
    [hadoop源码阅读][0]初衷和各种资源
    hadoop streaming和pipes资料
  • 原文地址:https://www.cnblogs.com/frankbadpot/p/1582782.html
Copyright © 2020-2023  润新知