1. 环境准备
Ubuntu14.04
sudo apt-get update
sudo apt-get install mpi-default-dev
sudo apt-get install libicu-dev
sudo apt-get install python-dev
sudo apt-get install libbz2-dev
2. 下载 boost1.58.0
sourceforge无法下载,百度查找解决方案,可以通过sourceforge mirror解决
wget http://sourceforge.mirrorservice.org/b/bo/boost/boost/1.58.0/boost_1_58_0.tar.gz
3. 解压tar.gz包并编译安装
tar xf boost_1_58_0.tar.gz
cd boost_1_58_0/
./bootstrap.sh
./b2 -a -sHAVE_ICU=1 # the parameter means that it support icu or unicode
sudo ./b2 install
4. 源码编译运行测试
#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;
}
//g++ test.cpp -o test
//g++ test.cpp -o test -std=c++14
5. 其他
测试通过。编译时间,本人虚拟机上编译大概2小时,取决于个人处理器内存不同。
网友评论