zoukankan      html  css  js  c++  java
  • C++ boost usage

    Install BOOST

    1. Build from source code

    Download the new release package from boost official website

    For windows, download zip or 7z format and unpack it using 7zip or winrar

    For linux/mac os, download tar.gz or tar.bz2, and unpack it by these command.

    tar zxf ....tar.gz -C ./ or tar jxf ...tar.bz2 -C ./

    cd the boost_1_xx_x

    for windows,  run bootstrap.bat to create bjam and b2

    for linux/mac os, run ./bootstrap.sh to create bjam and b2

    build the library for different compiler:

    for msvc

    mkdir msvc # store the msvc libraries

    ./bjam toolset=msvc-10.0 --build-dir=msvc --build-type=complete –stagedir=msvc --with-filesystem –disablefilesystem2

    其中build-dir是临时编译文件,而stagedir是最后使用的lib/dll文件路径,如果不是硬盘空间紧缺,建议保留build-dir里的文件,想上述命令,如果想在win32或者x64在windows下可以分别使用如下指令

    win32> ./bjam toolset=msvc-10.0 --build-dir=msvc/win32 --build-type=complete --stagedir=msvc/Win32 --with-filesystem –disablefilesystem2

    x64> ./bjam toolset=msvc-10.0 --build-dir=msvc/x64 --build-type=complete --stagedir=msvc/x64 --with-filesystem –disablefilesystem2 address-model=64

    注意:如果是编译64位,需要在vs64位命令行窗口中进行,同时需要加上address-model=64这个编译选项,否则在链接库的时候将会出现LNK2019的错误

    通常build-dir建立出来是指定路径下/boost/文件夹,而stagedir则是指定路径/lib/

    for gcc

    mkdir gcc # store the gcc libraries

    ./bjam toolset=gcc --build-dir=gcc --build-type=complete --stagedir=gcc --with-filesystem --disablefilesytem2 --layout=versioned

    for darwin

    mkdir darwin # store the darwin libraries

    ./bjam toolset=darwin --build-dir=darwin --build-type=complete --stagedir=darwin --with-filsystem --disablefilesystem2 --layout=versioned

    2. Use macport to install

    download the macport from officail website and then install it.

    Run these command to install it.

    sudo port selfupdate #update the software tree

    port search boost #check whether contains boost

    port info boost #check details about boost

    sudo port install boost

    the boost will be installed under /opt/local/include for header file, /opt/local/ilb for the library. If you want to change the path, need to build the source code using --prefix.

  • 相关阅读:
    (难)Codeforces Round #406 (Div. 2) C题Berzerk(有向图博弈)解题报告
    jquery清空kindEditor
    处理用户误输入html标签引起的网站布局混乱
    自动闭合所有标签的方法,用于获得textBox等值的时候,标签都是闭合的
    .NET一个页面多个Button按钮事件避免数据验证控件RequiredFieldValidator
    基类包括字段(),但其类型()与控件()的类型不兼容
    关于ajax回调数据类型为Json,如何获得他的值
    如何查找Repeater控件中嵌套的控件
    网站功能
    WIN7系统IIS上发布站点后水印效果失效的解决方法
  • 原文地址:https://www.cnblogs.com/rogerroddick/p/2846713.html
Copyright © 2011-2022 走看看