zoukankan      html  css  js  c++  java
  • Ubuntu14.04下codeblocks手动编译配置bost_1_57_0

    环境:ubuntu 14.04  32bit,boost_1_57_0

    前期准备:boost中,用到了别的函数库,所以为了使用boost中相应的功能,需要先安装系统中可能缺失的库 
    apt-get install mpi-default-dev  #安装mpi库
    apt-get install libicu-dev     #支持正则表达式的UNICODE字符集 
    apt-get install python-dev     #需要python的话

    apt-get install libbz2-dev     #如果编译出现错误:bzlib.h: No such file or directory


    上述函数库装好之后,就可以编译boost库了。解压boost_1_57_0.tar.gz:

    tar zxvf boost_1_57_0.tar.gz
    sudo mv boost_1_57_0 /usr/local/
    
    修改权限:

    chmod -R 755 /usr/local/boost_1_57
    转到boost根目录,执行脚本:

    sudo ./bootstrap.sh
    sudo ./bjam --with-date_time  //只编译了date_time
    


    
    

    编译完成的提示,根据提示配置codeblocks

    codeblocks菜单栏setting->compiler->Search directories

    在compiler下添加:/usr/local/boost_1_57_0

    在linker下添加:/usr/local/boost_1_57_0/stage/lib

    测试代码:

    #include <iostream>
    #include<thread>
    #include<chrono>
    #include<clocale>
    
    #include "boost/date_time/gregorian/gregorian.hpp"
    #include "boost/date_time/posix_time/posix_time.hpp"
    
    using namespace std;
    using namespace boost;
    using namespace boost::gregorian;
    using namespace boost::posix_time;
    
    int main()
    {
    	date d = day_clock::local_day();
    	date_facet* dfacet = new date_facet("%Y年%m月%d日");
    	cout.imbue(locale(cout.getloc(), dfacet));
    	cout << d << endl;
    
    	ptime tp = microsec_clock::local_time();
    	time_facet* tfacet = new time_facet("%Y年%m月%d日%H点%M分%S%F秒");
    	cout.imbue(locale(cout.getloc(), tfacet));
    	cout << tp << endl;
    
    
    	return 0;
    }
    

    输出:




  • 相关阅读:
    android gradle 打包命令
    android RRO
    android adb 常用命令
    mui执行滑动事件: Unable to preventDefault inside passive event listener
    获取 input[type=file] 文件上传尺寸
    MySQL:You can't specify target table for update in FROM clause
    input标签中autocomplete="off" 失效的解决办法
    @media属性针对苹果手机写法
    centos7 下mysql5.7修改默认编码格式为UTF-8
    使用Mui加载数据后a标签点击事件失效
  • 原文地址:https://www.cnblogs.com/ggzone/p/10121321.html
Copyright © 2011-2022 走看看