zoukankan      html  css  js  c++  java
  • boost 1.35.0 Visual Studio 2008编译指南

    一。下载

    boost库2008年3月底发布了1.35.0版本,包括了12个新的库和若干对于新库的修正。请参见http://www.boost.org/users/news/version_1_35_0来获取详细的更新信息。

    最大的喜讯就是提供了对于Visual Studio 2008编译器的支持(1.34也可以,但是需要手工修改)。

    下载地址:

    http://www.boost.org/users/download/

    boost JAM可以不用下载,源代码已经包括在boost库中,可以直接来编译出来。

    二。准备工作

    编译boost库之前,需要做一些准备工作。下载一些Open Source的包,来支持boost特定库的需要。

    1. ICU

    ICU提供了unicode和国际化支持,目前的版本是3.8.1。ICU的主页是http://www.icu-project.org/

    (1). 下载

    可以从http://www.icu-project.org/download/3.8.html下载源代码版本和使用VS2005编译的版本。推荐下载源代码版本自己进行编译,以避免依赖于VS2005的运行时库。

    (2). 编译

    ICU的编译比较简单,打开ICU源代码目录下的source"allinone"allinone.sln,需要转换到VS2008格式,直接转换即可。然后,选择release,Rebuild Solution即可。

    (3). 测试

    将编译出来的bin目录加入到系统的PATH目录中去。然后,重新打开allinone.sln工程。

    需要通过测试的项目

    1. cintltst项目
    2. intltest项目
    3. iotest

    分别设置成启动项目,运行即可。

    2. bzip

    bzip的主页是 http://www.bzip.org/,从http://www.bzip.org/downloads.html下面下载源代码包即可,boost直接使用源代码来进行编译。

    3. zlib

    zlib的主页是http://www.zlib.net/,从该网页下面下载源代码包即可,boost直接使用源代码来进行编译。

    4. python

    python的主页是http://www.python.org/,下载python的2.5.2版本,安装即可。boost默认是会编译python,并且会自动寻找python的安装目录。

    三。编译

    到开始菜单的VS2008菜单项下,启动Visual Studio 2008 Command Prompt,以下编译步骤均假定直接在该工具下进行编译。

    1. 编译jam

    到tools"jam目录下面运行build_dist.bat,编译好的放在tools"jam"stage"boost-jam-3.1.16-1-ntx86目录下,将bjam.exe复制到boost的根目录。

    2. 编译boost

    鉴于参考2下使用build-type有问题,可以使用以下命令来分别编译dll版本和lib版本。下面是一个示例脚本的例子,其中的目录需要替换:

    1REM used with iostream library

    2REM boost_1_35_0"libs"iostreams"doc"installation.html

    3

    4set BZIP2_SOURCE="E:"library"bzip2-1.0.4"

    5set ZLIB_SOURCE="E:"library"zlib123"

    6

    7REM used with regex library with unicode support

    8set ICU_PATH="E:"library"icu"

    9

    10REM DLL版本

    11bjam --toolset=msvc --stagedir=./lib_x86 --builddir=./ address-model=32 link=shared runtime-link=shared threading=multi stage debug release

    12

    13REM lib版本

    14bjam --toolset=msvc --stagedir=./lib_x86 --builddir=./ address-model=32 link=static runtime-link=shared threading=multi stage debug release

    15

    编译好的文件放置在boost根目录的lib_x86"lib目录下,在boost根目录下的bin.v2目录是中间文件,编译后删除即可。

    如果需要去掉编译过程中的一些warning,可以在tools"build"v2的user-config.jam文件中加入以下这一行:

    using msvc : : : <compileflags>/wd4819 <compileflags>/D_CRT_SECURE_NO_DEPRECATE <compileflags>/D_SCL_SECURE_NO_DEPRECATE <compileflags>/D_SECURE_SCL=0 ;

    四。参考文章

    1. vs2005下安装boost

    http://hi.baidu.com/vivid217/blog/item/8e484eafd3b52ff8faed5063.html

    2. boost1.35.0编译日志

    http://www.cppblog.com/chemz/archive/2008/03/31/45822.html

  • 相关阅读:
    Entity SQL 初入
    ObjectQuery查询及方法
    Entity Framework 的事务 DbTransaction
    Construct Binary Tree from Preorder and Inorder Traversal
    Reverse Linked List
    Best Time to Buy and Sell Stock
    Remove Duplicates from Sorted Array II
    Reverse Integer
    Implement Stack using Queues
    C++中const限定符的应用
  • 原文地址:https://www.cnblogs.com/chenhs/p/1270753.html
Copyright © 2011-2022 走看看