linux下安装boost
来源:互联网 发布:windows开机不显示壁纸 编辑:程序博客网 时间:2024/05/16 20:31
Boost库是一个经过千锤百炼、可移植、提供源代码的C++库,,作为标准库的后备,是C++标准化进程的发动机之一,在linux安装过程如下:
去官方网站下载最新的:http://sourceforge.net/projects/boost/files/boost/1.47.0/ or www.boost.org
搜到所有的boost库
然后:
sudo apt-get install libboost-all-dev
安装相应的库
1.下载后解压到/opt/boost_1_47_0
2.解决依赖关系 sudo apt-get install python-dev gccxml
如果还不全,就用apt-cache depends XXXXXXX查去
3.编译bjam:
#cd /opt/boost_1_47_0
#sudo ./bootstrap.sh
编译成功
4.编译boost
#sudo ./bjam
编译完成后:
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/home/terry/Local/boost_1_47_0
The following directory should be added to linker library paths:
/home/terry/Local/boost_1_47_0/stage/lib
因为我是解压到/home/terry/Local/boost_1_46_1下了
所以编译完了是这样的
#cat test.cpp
#include <boost/lexical_cast.hpp>
#include <iostream>
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;
}
2.编译,运行
--g++ -o test test.cpp
#ls
test test.cpp
# ./test
123456
123.456
去官方网站下载最新的:http://sourceforge.net/projects/boost/files/boost/1.47.0/ or www.boost.org
一,最简单的方法:
apt-cache search boost搜到所有的boost库
然后:
sudo apt-get install libboost-all-dev
安装相应的库
二,编译安装,
你需要到官方网站下载最新的版本,最新已经到1.47.0了1.下载后解压到/opt/boost_1_47_0
2.解决依赖关系 sudo apt-get install python-dev gccxml
如果还不全,就用apt-cache depends XXXXXXX查去
3.编译bjam:
#cd /opt/boost_1_47_0
#sudo ./bootstrap.sh
编译成功
4.编译boost
#sudo ./bjam
开始编译
大约要个十几分钟编译完成后:
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/home/terry/Local/boost_1_47_0
The following directory should be added to linker library paths:
/home/terry/Local/boost_1_47_0/stage/lib
因为我是解压到/home/terry/Local/boost_1_46_1下了
所以编译完了是这样的
5.update动态链接库:
sudo ldconfig
安装完毕三,测试使用:
1.测试代码#cat test.cpp
#include <boost/lexical_cast.hpp>
#include <iostream>
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;
}
2.编译,运行
--g++ -o test test.cpp
#ls
test test.cpp
# ./test
123456
123.456
0 0
- linux下安装boost
- Linux下安装boost
- linux 下安装boost
- linux下安装boost
- linux 下安装boost
- linux下安装boost
- linux下安装boost
- Linux 下安装Boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- linux下安装boost
- 给jquery-validation插件添加控件的验证回调方法
- VC编译选项md /mdd /ml /mt/mtd
- Spring组件扫描<context:component-scan/>使用详解
- Date、String和Timestamp类型转换
- inotify的一个简单程序
- linux下安装boost
- LOGO图片详细说明(作业)
- Django学习笔记+官方网站
- android【资源汇总分享】Android开发资源汇总之一
- CSS 实现加载动画之七-彩环旋转
- Oracle中通过Function,存储过程,触发器,调用实现解析Clob字段中存在的xml字符串
- rz传文件老是不对的问题
- MySQL InnoDB性能调整的一点实践
- leetcode_Maximum Product Subarray