请教使用boost/lexical_cast的问题
想在一个console application中使用boost/lexical_cast将字符串转换为数值的功能,
VC6中设置了include路径,源码如下:
#include "stdafx.h"
#include <iostream>
#include <boost/lexical_cast.hpp>
using namespace std;
int main(int argc, char *argv[])
{
using boost::lexical_cast;
int a = lexical_cast<int>("123");
double b = lexical_cast<double>("123.12");
cout << a << endl;
cout << b << endl;
return 0;
}
编译出错:
error C2062: type 'int' unexpected
error C2062: type 'double' unexpected
请问如何解决?多谢!!!