ubuntu14.04 boost 1.58.0 安裝
1.首先下载安装包,然后解压, 切换目录
wget -o boost_1_58_0.gar.gz http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download tar xf boost_1_58_0.tar.gz cd boost_1_58_0
2. 编译前安装必要的库
sudo apt-get install mpi-default-dev # mpi related sudo apt-get install libicu-dev # regular expresion related sudo apt-get install python-dev # python dev related sudo apt-get install libbz2-dev
3. 编译安装boost
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. 测试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; }
编译
g++ testBoost.cpp -lboost_system -lboost_filesystem -o testBoost ./testBoost
运行结果
max timespan: ....
min timespan: ....
作者:白菜菜白
出处:http://www.cnblogs.com/lvchaoshun/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。