标题:“ error C2065: “cout”: 未声明的标识符”是怎么回事
只看楼主
digimon
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-8-27
 问题点数:0 回复次数:2 
“ error C2065: “cout”: 未声明的标识符”是怎么回事

我是C++新手,入门时按照书上的编写第一个程序Hello World时出现如下错误:

c:\documents and settings\digimon\my documents\visual studio 2005\projects\helloworld\helloworld\helloworld.cpp(8) : error C2065: “cout”: 未声明的标识符

不知是为什么,我用的是VC++ 2005,高手解答一下

源程序:
// helloworld.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

int _tmain()
{
cout<< "hello world! \n";
return 0;
}

[此贴子已经被作者于2007-8-27 12:11:35编辑过]

搜索更多相关主题的帖子: cout error helloworld cpp 
2007-08-27 12:08
kzqjun2008
Rank: 1
等 级:新手上路
帖 子:50
专家分:0
注 册:2007-2-10
得分:0 
是不是要包含 iostream.h 阿?
2007-08-27 18:26
Arcticanimal
Rank: 3Rank: 3
等 级:论坛游民
威 望:7
帖 子:341
专家分:20
注 册:2007-3-17
得分:0 
VS 2005里面是没有 iostream.h 这个文件的,要使用输入输出流只能:
#include<iostream>
using namespace std;
//......
默认建立工程的时候没有#include<iostream>

try new catch
2007-08-27 20:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-165702-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.090276 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved