Centos6.5 安装boost库

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Qiana_/article/details/81811465

要使用boost中的有些内容,在网上找了一下,有些安装很复杂。最终找到了一个很简单的安装boost的方法。

环境:Centos6.5   gcc 4.8.2  g++ 4.8.2

yum install boost
yum install boost-devel
yum install boost-doc

测试一下:

代码来自:https://blog.csdn.net/qiuyoujie/article/details/78559944

#include <boost/version.hpp>
#include <boost/config.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>

using namespace std;

int main()
{
  using boost::lexical_cast;
  int a= lexical_cast<int>("123456");
  double b = lexical_cast<double>("123.456");
  std::cout << a << std::endl;
  std::cout << b << std::endl;
  return 0;
}

执行一下:g++ -Wall -o test_boost test_boost.cpp

安装完成!

猜你喜欢

转载自blog.csdn.net/Qiana_/article/details/81811465