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;
    }
    

    输出:




  • 相关阅读:
    centos6.5mini版安装及配置
    ruby读取exce文件,使用roo---Gem
    L3-Day34
    keepalived+nginx实现高可用+tomcat
    破解IDEA注册码,设置 license server一直有效不过期
    nginx配置文件详解
    Windows如何设置动态和静态ip地址
    Tortoisegit生成SSH密钥一次性输入密码
    ajax
    myeclipse tomcat部署按钮点击没反应
  • 原文地址:https://www.cnblogs.com/ggzone/p/4227040.html
Copyright © 2011-2022 走看看