【20171122】Ubuntu16.04安装boost库

参考此页教程第二种方法

http://blog.chinaunix.net/uid-12226757-id-3427282.html


1.在boost官网上(www.boost.org)下载最新版本

解压到指定位置(最好在【/home】目录下,为了方便不同用户使用。不过,这电脑只有我一人用所以随便了,个人放在【/下载】目录)


2.进入此目录下右键打开终端,配置环境

sudo ./bootstrap.sh 


3.运行之前配置环境后得到的文件,使用./命令

./bjam


4.检验安装成功否:在linux下任意目录下创建test.cpp

#include 
#include "boost/lexical_cast.hpp"
#include 
#include 
using namespace std;
int main()
{
    string s="100";
    int a=boost::lexical_cast(s);
    int b=1;
    cout<<(a+b) <

运行命令

g++ test.cpp -o test
./test





你可能感兴趣的:(linux)