编译安装
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
gzip -dv boost_1_67_0.tar.gz
tar -zxvf boost_1_67_0.tar
./boostrap.sh --help
./bootstrap.sh
./b2 install
默认安装在/usr/local的lib, include中
示例
g++ -o first first.cpp -lboost_timer -lboost_system
first.cpp:
#include <vector> #include <iostream> #include <boost/foreach.hpp> #include <boost/assign.hpp> #include <boost/timer.hpp> using namespace std; using namespace boost; int main(){ timer t; vector<int> v = (assign::list_of(1), 2, 3, 4, 5); BOOST_FOREACH(int x, v){ cout<<x<<","; } cout<<endl; cout<<t.elapsed()<<"s"<<endl; cout<<"hello world!"<<endl; return 0; }
原文链接: https://www.cnblogs.com/yeahle/p/12418291.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;
也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/333554
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!