首页 / 操作系统 / Linux / Ubuntu 14.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编译完成的提示,根据提示配置codeblockscodeblocks菜单栏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;
}输出: Ubuntu 12.04 下安装Code::Block 见 http://www.linuxidc.com/Linux/2012-10/73116.htmLinux环境中使用CodeBlocks编译Makefile工程 http://www.linuxidc.com/Linux/2014-04/100140.htmUbuntu 13.04 配置CodeBlocks中的GLUT http://www.linuxidc.com/Linux/2014-03/99121.htm使用C语言操作MySQL数据库 CodeBlocks开发环境配置 http://www.linuxidc.com/Linux/2013-05/84366.htm使用CodeBlocks自己做模板做Gtkmm开发 有代码提示 http://www.linuxidc.com/Linux/2011-06/37164.htm更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2本文永久更新链接地址