如何用VC.net环境编译C++程序?

hahahawk 2003-04-11 03:41:48
如何用VC.net环境编译C++程序?
我把msdn中一段standard c++程序如下:
#include <string>
#include <iostream>

void main()
{
string s1;
cout << "Enter a sentence (use <space> as the delimiter): ";
getline(cin,s1, ' ');
cout << "You entered: " << s1 << endl;;
}
在VC环境中编译,报错:
c:\wuq\cpp\mycdll\mycdll.cpp(9): error C2065: “string” : 未声明的标识符

请问既然包含了头文件string,(编译时候也没要报找不到该文件,该文件确实存在)
为何还找不到该类型?
...全文
16 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lymgf 2003-04-12
  • 打赏
  • 举报
回复
using namespace std

or

#include <string.h>
#include <iostream.h>
用户 昵称 2003-04-12
  • 打赏
  • 举报
回复
vc就是这么niu,包含stdafx.h, windows.h试试
wfufo2002 2003-04-11
  • 打赏
  • 举报
回复
是不是大小写的问题呢?

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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