ubuntu14.04 boost 1.58.0 安裝

1.首先下載安裝包,而後解壓, 切換目錄python

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. 編譯前安裝必要的庫ios

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. 編譯安裝boostc++

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是否安裝成功bootstrap

    c++代碼(testBoost.cpp)bash

 #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

    運行結果spa

    max timespan:  .....net

    min timespan:  ....code

相關文章
相關標籤/搜索