我的代码有误 [英] error with my code
本文介绍了我的代码有误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我理解为什么会出现此错误?,我正在做练习.我从我的书中获得了这段代码,但它告诉我我有此错误
C2065: ''cout'' : undeclared identifier
看看我的代码
please help me understand why this error ?, am doing exercise .i got this code from my book but it tells me that i have this error
C2065: ''cout'' : undeclared identifier
look at my code
#include <iostream>
int main ()
{
cout << "Hello World!\n";
return 0;
}
在使用Visual Studio 2005
am using Visual Studio 2005
推荐答案
时,您需要从命名空间std显式作用域cout,或完全作用域命名空间. std :: cout将起作用.我相信它正在使用命名空间std;但是我已经很久没有使用C ++了,这可能是错误的.
you need to either explicitly scope cout from namespace std, or scope the namespace entirely. std::cout will work. I believe it''s using namespace std; but I''m so long out of C++, that could be wrong.
cout
是由<iostream>
在std
命名空间内定义的.
你可以做
cout
is defined by<iostream>
inside thestd
namespace.
You can either do
...
std::cout << "your text" << std::endl;
...
或
or
...
using namespace std;
...
cout << "your text" << std::endl;
...
这篇关于我的代码有误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文