bbc纪录片东非大裂谷:在Ubuntu下安装boost库

来源:百度文库 编辑:偶看新闻 时间:2024/05/02 09:47:47
在命令行下键入 sudo apt-get install libboost-dev libboost-dbg libboost-doc bcp libboost-*
运行完boost库就安装好了。
写一个测试程序测试一下。
vim test.cpp
#include
#include
int main()
{
using boost::lexical_cast;
int a = lexical_cast("123456");
double b = lexical_cast("123.456");
std::cout << a << std::endl;
std::cout << b << std::endl;
return 0;
}
编译:
g++ -o test test.cpp
运行结果:
./test
123456
123.456