vs2010未声明的标识符

cguangfei 2013-02-11 08:58:08
// myfirst.cpp--displays a message

#include <stdafx.h> // a PREPROCESSOR directive
int main() // function header
{ // start of function body
using namespace std; // make definitions visible
cout << "Come up and C++ me some time."; // message
cout << endl; // start a new line
cout << "You won't regret it!" << endl; // more output
// If the output window closes before you can read it,
// add the following code:
// cout << "Press any key to continue." <<endl;
// cin.get();
return 0; // terminate main()
} // end of function body

1>------ 已启动生成: 项目: ConsoleApplication9, 配置: Debug Win32 ------
1> ConsoleApplication9.cpp
1>c:\users\time\documents\visual studio 2012\projects\consoleapplication9\consoleapplication9\consoleapplication9.cpp(7): error C2065: “cout”: 未声明的标识符
1>c:\users\time\documents\visual studio 2012\projects\consoleapplication9\consoleapplication9\consoleapplication9.cpp(8): error C2065: “cout”: 未声明的标识符
1>c:\users\time\documents\visual studio 2012\projects\consoleapplication9\consoleapplication9\consoleapplication9.cpp(8): error C2065: “endl”: 未声明的标识符
1>c:\users\time\documents\visual studio 2012\projects\consoleapplication9\consoleapplication9\consoleapplication9.cpp(9): error C2065: “cout”: 未声明的标识符
1>c:\users\time\documents\visual studio 2012\projects\consoleapplication9\consoleapplication9\consoleapplication9.cpp(9): error C2065: “endl”: 未声明的标识符
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========



大家怎么看?
...全文
739 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cguangfei 2013-02-11
  • 打赏
  • 举报
回复
我都已经从装系统了,:-<
botieking 2013-02-11
  • 打赏
  • 举报
回复
你再装一遍vs试一下。。。我用的vc6.0,有时候出现各种莫名其妙的错误都会再装一次。。。
cguangfei 2013-02-11
  • 打赏
  • 举报
回复
LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 我把书上的代码打上去都会出现这个 我查了一下,还是不知道如何解决 你怎么看
botieking 2013-02-11
  • 打赏
  • 举报
回复
建议你在win32 console下试试。。。并且using namespace std;要放在main()的前面,不要放在main里面
cguangfei 2013-02-11
  • 打赏
  • 举报
回复
#include <iostream> int main() { using namespace std; cout << "Come up and C++ me some time."; cout << endl; cout << "You won't regret it!" << endl; return 0; } 1>------ 已启动生成: 项目: 4, 配置: Debug Win32 ------ 1>生成启动时间为 2013/2/11 21:17:55。 1>PrepareForBuild: 1> 正在创建目录“c:\users\time\documents\visual studio 2010\Projects\4\Debug\”。 1>InitializeBuildStatus: 1> 正在创建“Debug\4.unsuccessfulbuild”,因为已指定“AlwaysCreate”。 1>LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 1> 1>生成失败。 1> 1>已用时间 00:00:02.03 ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ========== 纠结啊,你们怎么看
botieking 2013-02-11
  • 打赏
  • 举报
回复
少了#include <iostream>

65,186

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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