错误C2065:'cout':未声明的标识符 [英] error C2065: 'cout' : undeclared identifier

查看:1445
本文介绍了错误C2065:'cout':未声明的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编程作业的驱动程序部分,我一直得到这个荒谬的错误:

I am working on the 'driver' part of my programing assignment and i keep getting this absurd error:


错误C2065: cout':undeclared identifier

error C2065: 'cout' : undeclared identifier

我已经尝试过使用 std :: cout 说: IntelliSense:命名空间std没有成员cout时,我已宣布 using namespace std,包含iostream +甚至试图使用 / strong>

I have even tried using the std::cout but i get another error that says: IntelliSense: namespace "std" has no member "cout" when i have declared using namespace std, included iostream + i even tried to use ostream

我知道这是一个标准的noob问题,但这已经让我失望,我是一个新手(意思是:我之前编程...) p>

I know it's a standard noob question but this has stumped me and I'm a novice (meaning: I've programed before...)

#include <iostream>
using namespace std;

int main () {
    cout << "hey" << endl;
 return 0;
}


$ b $ p我使用Visual Studio 2010和运行Windows 7。 h文件有using namespace std并包括iostream和ostream。

I'm using Visual Studio 2010 and running Windows 7. All of the .h files have "using namespace std" and include iostream and ostream.

推荐答案

写这个代码, p>

write this code, it works perfectly..

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
 cout<<"Hello World!";
  return 0;
}

这篇关于错误C2065:'cout':未声明的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆