boost库在VC6里面怎以用不了?

lxwsoft 2004-11-22 12:37:33
#include "stdafx.h"
#include <iostream>
#include <boost/lexical_cast.hpp>

int main(int argc, char* argv[])
{
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;

system("PAUSE");
return 0;
}

编绎后报错:type 'int' unexpected
type 'double' unexpected
syntax error : missing ';' before 'tag::id'

以上代码在CB6里面没问题,怎么在VC里面就不行了呢?
...全文
115 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxwsoft 2004-11-22
  • 打赏
  • 举报
回复
boost库不时可以在VC里面用的吗?VC6对C++标准的支持非常不好但也不至于向上面那样也编绎通不过吧
oyljerry 2004-11-22
  • 打赏
  • 举报
回复
vc6需要注意一些奇怪的地方
北极猩猩 2004-11-22
  • 打赏
  • 举报
回复
首先要说得是VC6对C++标准的支持非常不好,因此使用这些模板库的时候尽量少用VC6。
大雾 2004-11-22
  • 打赏
  • 举报
回复
楼上说的没有错,也可以直接用boost::
可能VC6对using declaration的支持有些问题。
hcj2002 2004-11-22
  • 打赏
  • 举报
回复
#include <iostream>
#include <boost/lexical_cast.hpp>
using namespace boost;

int main(int argc, char* argv[])
{
//using boost::lexical_cast;
using namespace boost; //改成这一局就可以了
int a = lexical_cast<int>("123");
double b = lexical_cast<double>("123.12");
std::cout<<a<<std::endl; // 此处少一个分号
std::cout<<b<<std::endl;

system("PAUSE");
return 0;
}

24,854

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧