【20171122】Ubuntu16.04安装boost库

来源:互联网 发布:windows 98 双核 编辑:程序博客网 时间:2024/06/07 10:34

参考此页教程第二种方法

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 <iostream>#include "boost/lexical_cast.hpp"#include <string.h>#include <string>using namespace std;int main(){    string s="100";    int a=boost::lexical_cast<int>(s);    int b=1;    cout<<(a+b) <<endl;//输出101    return 0;}

运行命令

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





原创粉丝点击