`
qimo601
  • 浏览: 3414925 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

fatal error C1083: Cannot open include file: 'iostream.h': No such file or dire

阅读更多

错误: fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory

 

我的源代码测试回调函数,编译不通过,出现如上错误。

 

原因:

#include <iostream.h>改为

   #include <iostream>using namespace std;

新的c++标准库摒弃了.h的头文件形式,因此是没有iostream.h文件的。在老的编辑环境中,例如VC6里面,iostream.h的形式还是存在的,因此你的程序在VC6里面是可以编译通过的。但是vs2005及以上的版本,对应新的c++标准,引入了名字空间的概念,没有.h的形式。

 

我的错误源码:

 

 

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

//回调函数指针
typedef int(WINAPI* WNDCALLBACK)(int*,int*);
//回调函数
int __stdcall Call(int *a,int *b);
//定义类
class A
{
public:
	//比较两个数字大小
	int Compare(int m,int n,WNDCALLBACK function)
	{
		int *a=&m;
		int *b=&n;
		return (*function)(a,b);
	}
};

int main(int argc, char* argv[])
{
	int a=10;
	int b=6;
	A m_a;
	cout<<m_a.Compare(a,b,Call)<<endl;
	return 0;
}

//回调函数
int CALLBACK Call(int *a,int *b)
{	
	return *a>(*b)?(*a):(*b);
}
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics