afxv_w32.h(16): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include

来源:互联网 发布:电子地图综合搜索软件 编辑:程序博客网 时间:2024/05/18 11:21

网上的几种解决方法:

1、删除stdafx.h中的windows.h,改为#include "afx.h"

2、在你的工程所有包含头文件的地方查找这个:#include <afx.h>如果有的话,把这句话放在其它包含文件语句的上面。这个是编译器编译顺序的问题。

3、将可能包含有#include "windows.h"的头文件放在其他头文件之后#include。

4、有些情况下,可以这样操作

#undef _WINDOWS_

#include "windows.h"


上面的方法没能直接解决这个问题。

后面把#include <windows.h>注释,在上面加了#include "stdafx.h",就OK了


#include "stdafx.h"

#ifdef WIN32

//#include <windows.h>
#define SLEEP_FUNC(ms) Sleep(ms)
#else
#include <unistd.h>
#define SLEEP_FUNC(ms) usleep(ms*1000);
#endif
0 0