linux 编译boost_1_55

 从www.boost.org下载当前boost库,当前文件名为:boost_1_55_0.tar.gz

 

 在当前位置解压。

 

tar -xvf boost_1_55.tar.gz 

 

  进入解压后的目录,执行bootstarp.sh脚本。

  

./bootstarp.sh  

 

  运行完毕后,目录中多出b2和bjam,运行b2。

  

./b2 install 

 

  会自动安装到/usr/local/include和/usr/local/lib中。

 

  打印$PATH,查看是否在路径中,若没有请添加。

  另外,请查看 ./b2 --help

  根据自己的需要来选择编译条件。

 

1 #include <iostream>  
2 #include <boost/lexical_cast.hpp>  
3   
4 int main()  
5 {  
6     int nValue = boost::lexical_cast<int>("123456789");  
7     std::cout<< nValue << std::endl;  
8     return 0;  
9 }  
View Code

 

 

  编译:

 

g++ test.cpp -o test  

 

  如果执行后出现数字:123456789则说明成功。

posted @ 2014-07-21 09:34  alex_my  阅读(303)  评论(0编辑  收藏  举报