• Ubuntu16.04搭建boost环境


    下载地址:http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download
    编译前所需的库
    1 sudo apt-get install mpi-default-dev # mpi related
    2 sudo apt-get install libicu-dev # regular expresion related
    3 sudo apt-get install python-dev # python dev related
    4 sudo apt-get install libbz2-dev # I don't know
    
    编译安装boost
    1 tar xf boost_1_58_0.tar.gz
    2 cd boost_1_58_0/
    3 ./bootstrap.sh
    4 ./b2 -a -sHAVE_ICU=1 # the parameter means that it support icu or unicode
    5 sudo ./b2 install

    //自定义安装路径,将boost库路径写入配置文件。
    echo "/usr/local/lib/boost" >> /etc/ld.so.conf.d/usr_local_lib.conf
    ldconfig
    测试boost是否安装成功
    c++代码(testBoost.cpp)
    #include <iostream>
    #include <boost/timer.hpp>
    
    using namespace boost;
    
    int main()
    {
        timer t;
        std::cout << "max timespan:" << t.elapsed_max() / 3600 << "h" << std::endl;
        std::cout << "min timespan:" << t.elapsed_min() << "s" << std::endl;
    
        std::cout << "now itme elapsed:" << t.elapsed() << "s" << std::endl;
    
        return EXIT_SUCCESS;
    }
    Makefile:
    FLAG +=-std=c++11
    FLAG += -g -Wall
    FLAG += -O0
    SRC += main.cpp
    GCC = g++
    DEMO= DEMO
    demo:
            $(GCC) $(FLAG) $(SRC) -o $(DEMO)
    clean:
            rm DEMO
  • 相关阅读:
    linux学习之uniq
    hive学习05 参数设置
    【python】调用sm.ms图床api接口,实现上传图片并返回url
    【python】列表与数组之间的相互转换
    更新yum源
    要把RAID5创建卷组
    named-checkconf -z /etc/named.conf
    function_exists
    trigger_error
    命名空间
  • 原文地址:https://www.cnblogs.com/osbreak/p/9715788.html
Copyright © 2020-2023  润新知