c++ boost安装

boost 官网: https://sourceforge.net/projects/boost/files/boost/

5.1   Easy Build and Install

Issue the following commands in the shell (don't type $; that represents the shell's prompt):

$ cd path/to/boost_1_72_0
$ ./bootstrap.sh --help

Select your configuration options and invoke ./bootstrap.sh again without the --help option. Unless you have write permission in your system's /usr/local/ directory, you'll probably want to at least use

$ ./bootstrap.sh --prefix=path/to/installation/prefix

to install somewhere else. Also, consider using the --show-libraries and --with-libraries=library-name-list options to limit the long wait you'll experience if you build everything. Finally,

$ ./b2 install

will leave Boost binaries in the lib/ subdirectory of your installation prefix. You will also find a copy of the Boost headers in the include/ subdirectory of the installation prefix, so you can henceforth use that directory as an #include path in place of the Boost root directory.

-----------------------------------------------------------------------------------------------------------------------------------以上内容摘自官网

首先进入官网下载自己想要的版本

1 解压 tar -xzvf boost_1_72_0.tar.gz

2 进入 cd  boost_1_72_0

3 执行 ./bootstrap.sh  如果自己有想要安装的目录则  ./bootstrap.sh --prefix=path/to/installation/prefix

4 ./b2 --show-libraries  看下有哪些库 如果知道自己需要哪些库 ./b2 --with-libraries=library-name-list   
   全要  ./b2 install 

5 测试一下 

#include <boost/regex.hpp>
#include <iostream>
#include <string>

int main()
{
    std::string line;
    boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );

    while (std::cin)
    {
        std::getline(std::cin, line);
        boost::smatch matches;
        if (boost::regex_match(line, matches, pat))
            std::cout << matches[2] << std::endl;
    }
}

记得引用对应的库  默认的话在 /usr/local/lib/

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值