Boost库的下载及总结

boost 库是c++标准库的拓展,很实用。

赶紧提升C++技能。

因为有个游戏安装需要下载boost库,查阅晚上相关文档,这么好的库应该极大地发扬光大才是啊。

官网http://www.boost.org/

下载地址

https://sourceforge.net/projects/boost/files/boost/1.63.0/

访问有点慢的话访问百度网盘下载。

https://pan.baidu.com/s/1bpKPKsf

安装,可以看到非常简单,还提供学习网站。

指导手册

file:///home/wang/Downloads/boost_1_63_0/more/getting_started/unix-variants.html#build-a-simple-program-using-boost

也可以指定安装目录,具体查询--help解决。

./bootstrap.sh --prefix=/usr

./b2 install

wang@wang:~/Downloads/boost_1_63_0$ ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 2.7
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide:
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - Boost.Build documentation:
     http://www.boost.org/build/doc/html/index.html

执行./b2

The Boost C++ Libraries were successfully built!

The following directory should be added to compiler include paths:

    /home/wang/Downloads/boost_1_63_0

The following directory should be added to linker library paths:

    /home/wang/Downloads/boost_1_63_0/stage/lib

执行

./bjam


可以看到已经安装完成。

写一个程序进行测试说明

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

wang@wang:~$ g++ -I /home/wang/Downloads/boost_1_63_0 labmda.cpp -o lambda
wang@wang:~$ echo 1 2 3 | ./example
bash: ./example: No such file or directory
wang@wang:~$ echo 1 2 3 | ./lambda
3 6 9 wang@wang:~$

结果,正确安装。




  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值