今天突然来了兴致,下了个Boost来玩。与其说不用用这个Boost,倒不如说还没有了解,所以搜了一大堆资料,在Boost 中文站逗留了很久,由于我的编译器是MinGW,我郁闷的是到底要怎样才能让MinGW能用上Boost的库呢?在我百思不得其解的情况下,用了一个很傻的方法,就是将Boost下了的解压包里那个boost文件夹复制到MinGW里的include里面,虽然不知道具体Boost有多强大,不过这个方法跟我在网上搜到的资料感觉很不一样的~看到有人说要编译成库,什么意思呢????
按我的这个方法又倒是可以编译
#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;
}
开始Boost之旅~