所以,我有这个问题。为什么 cout 会抛出异常
error C2065: 'cout' : undeclared identifier
我正在使用 Visual Studio 2012 作为 IDE,并且正在编写一个学校项目。除了示例文件之外,我已经完成了所有操作。所以我尝试在屏幕上写下这样的内容:
#include "iostream"
#include "stdafx.h"
using namespace std;
int main()
{
cout<<"example";
return 0;
}
所以问题出在 cout...printf 工作正常,但我想使用 cout。
编辑:
我已将“”更改为,但没有帮助。另外,我仅使用此代码作为示例...这不是整个项目。
stdafx.h
应是源文件中的第一个包含指令。
切换文件并将第二个包含转换为<>
,正如其他人建议的那样。
#include "stdafx.h"
#include <iostream>
See 这个帖子了解更多信息。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)