在命令行下鍵入 sudo apt-get install libboost-dev libboost-dbg libboost-doc bcp libboost-*
運(yùn)行完boost庫(kù)就安裝好了。
寫一個(gè)測(cè)試程序測(cè)試一下。
vim 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;
}
編譯:
g++ -o test test.cpp
運(yùn)行結(jié)果:
./test
123456
123.456
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。