1 【问题背景】C++/MFC中出现 Error    C2065错误,即未定义xxx错误,而你使用的xxx是基础类库的,你心里想不可能不存在呀。当然排除你拼写错误的情况,咱不讨论这种情况。

2 【分析】检查在VS/VC基础类库加载没问题,平台设置没问题; 一般是由于将某些头文件放在stdafx.h头文件前。

3 【解法举例】

3.1 如上标题问题: Error    C2065    'cout': undeclared identifier。这是由于在实现文件中这样的放置头文件"iostream.h"了,如下:

//下面是xxxx.cpp 实现

#include <iostream.h>

#include "stdafx.h"

//.........

int xxx_fun()

{

std::cout<< somevar<<std::endl;

}

3.1.1 【结果】以上就会出现error C2065;

3.2 【修改方法】将stdafx.h放在最前面,不让别的头文件话在其前面。

//下面是xxxx.cpp 实现

#include "stdafx.h"

#include <iostream.h>

//.........

int xxx_fun()

{

std::cout<< somevar<<std::endl;

}

3.2.1 【结果】以上就不会有error C2065出现;

3.3 【小结】如果将库及平台正确配置正确,以上的方法基本可以解决。这个问题是一个很容易忽略的小错误,因为放个头文件,一般我们没觉得必须要分先后。好吧,细节决定成败,竞技场第一名与第二名有时往往差别0.001秒的差距,所以,也别说什么小不小的错误了。

Error C2065 'cout': undeclared identifier相关推荐

  1. 【C++】error C2065: ‘vector‘ : undeclared identifier

    问题: 使用vector时报错:error C2065: 'vector' : undeclared identifier 解决: 使用Vector  不仅需要加头文件 #include <ve ...

  2. error C2065: 'assert' : undeclared identifier

    F:\VC6.0 : error C2065: 'assert' : undeclared identifier 导入#include <assert.h> 转载于:https://www ...

  3. c语言编译kbhit出现问题,在VC++中运行出现error C2065: 'kbhit' : undeclared identifier,什么意思?怎么调试?...

    在VC++中运行出现error C2065: 'kbhit' : undeclared identifier,什么意思?怎么调试?0 yareate2013.04.08浏览493次分享举报 #defi ...

  4. error C2065: ‘salary‘ : undeclared identifier

    报错:error C2065: 'salary' : undeclared identifier 例子 例子 int main() {int num;scanf("%d", &am ...

  5. error C2065: '_lpw ' : undeclared identifier

    error   C2065:   '_lpw '   :   undeclared   identifier VC6编译ATL工程时的错误(与W2A,W2T有关), 忘了用USES_CONVERSIO ...

  6. c语言 'max' : undeclared identifier,函数调用老是error C2065: 'getmax' : undeclared identifier怎么处理...

    函数调用老是error C2065: 'getmax' : undeclared identifier怎么办 #include #include                             ...

  7. error C2065: 'ULONG_PTR' : undeclared identifier

    处理方法: 把#define ULONG_PTR ULONG  加到 stdafx文件 靠前面的位置 原因: Visual C++ 6.0 开发环境, gdi+ 的头文件和库文件并没有被包含在环境中, ...

  8. error C2065: 'IDD_***' : undeclared identifier

    You have to include resource.h, where the resource editor defines 'IDC_***' or 'IDD_***' 转载于:https:/ ...

  9. VC解决error C2065: 'timeGetTime' : undeclared identi

    2009-03-28 13:40 在VC的.cpp中加入如下头文件及库的引用. #include <afxinet.h> #include <wininet.h> #inclu ...

最新文章

  1. linux下安装redmine1.2.1全记录
  2. ISE和Modelsim联合仿真
  3. Testing and Test-First Programming
  4. qfileinfolist 取中间_公司起名:网络公司名字起名寓意如何取寓意成功的网络公司名字...
  5. 算法:62唯一路径Unique Paths 动态规划和排列组合算法
  6. huhamhire-hosts
  7. android 系统签名
  8. appium-desktop 1.13 windows 版本网盘下载
  9. 花呗的24期利息计算器_花呗24期怎么算利息怎么算(花呗借600024期要还多少利息?)...
  10. 5s管理清洁活动如何推行?
  11. python自动排版公众号_GitHub - sunshine2337/maxpress: MaxPress:MarkDown+Python实现微信公众号一键排版...
  12. 如何批量替换文件夹名称中的指定字符?
  13. 苹果iCloud服务疑遭中国黑客攻击
  14. windows好用的cmd命令
  15. C语言 两个整数的四则运算
  16. php水解蛋白技术,乳蛋白部分水解配方奶粉:美赞臣亲舒
  17. 正则表达式把html中换行去掉,JS去除空格和换行的正则表达式(推荐)
  18. 安装SQL Serve
  19. 如何检查MDAC版本,如何查看MDAC版本
  20. 软件工程毕业设计课题(12)基于python的毕业设计python校园二手书籍交易网站系统毕设作品源码

热门文章

  1. NAMD跑分子动力学模拟出现的一些问题(更新中)
  2. 语义相似度的计算方法
  3. office(word)如何使用格式刷的方法。
  4. Qt的基本控件——显示控件
  5. 深度和广度优先算法题
  6. 【FPGA基础篇】底层结构组成
  7. Class 2 基于ECS快速搭建Docker环境
  8. 计算机打印东西怎么横向打印机,ms xps虚拟打印机,如何横向打印显示?
  9. Win10下通过源码编译安装QGIS
  10. 使用string_to_array时,报错operator does not exist: character varying = text[]