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 改为

   #include using namespace std;

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

 

我的错误源码:

 

 

#include "stdafx.h"
#include "windows.h"
#include 

//回调函数指针
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<(*b)?(*a):(*b);
}
 

 

你可能感兴趣的:(C/C++,iostream.h,No,such,file,编译出错。)