首页 > 代码库 > boost安装

boost安装

下载
http://www.boost.org/

安装
文件解压在/usr/local/目录下
在/usr/local/boost-*目录下,执行./bootstrap.sh
在/usr/local/boost-*目录下,执行sudo ./bjam  --layout=versioned --build-type=complete --toolset=gcc install 
在/etc/profie中添加:
export BOOST_INCLUDE=/usr/local/include/boost-1_52
export BOOST_LIB=/usr/local/lib

测试
test.cpp

#include <boost/lexical_cast.hpp>
#include <iostream>
int main()
{
        using boost::lexical_cast;
        int a = lexical_cast<int>("123");
        double b = lexical_cast<double>("123.12");
        std::cout<<a<<std::endl;
        std::cout<<b<<std::endl;
        return 0;
}

编译
g++ test.cpp -I$BOOST_INCLUDE -L$BOOST_LIB -o test
gcc下编译命令为gcc test.cpp -I$BOOST_INCLUDE -L$BOOST_LIB -lstdc++ -o test

boost中文手册
http://stlchina.huhoo.net/twiki/bin/view.pl/Main/BoostIndex
安装
http://blog.csdn.net/garfier/article/details/7773409
http://www.cnblogs.com/zhangchaoyang/articles/2048952.html
boost c++ library on linux 初体验
http://blog.csdn.net/garfier/article/details/7773409

vim cpp补齐插件OminCppComplete安装,boost库ctags文件生成脚本


boost安装