e:\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>
说是#include <windows.h>多余,但是我的MFC程序里面没有#include<windows.h>,这是怎么回事?
本来程序还好,但是尝试连接数据库之后,就报这个错误

解决方案 »

  1.   

    MFC自己在afxwin.h包含了 你去掉windows.h即可,不用自己包含的
      

  2.   

    包含路径是"stdafx.h"/<afxwin.h> /<afx.h>/<afxver_.h>/<afxv_w32.h>/<windows.h>
    所以你不用在mfc程序中单独包含windows.h
      

  3.   

    现在我的程序里面没有包含#include <windows.h>,我搜索的话搜索不到
      

  4.   

    把stdafx.h中#import "C:\Program Files\Common Files\System\ado\msado15.dll" 这一行都去掉。
      

  5.   

    现在我的程序里面没有包含#include <windows.h>,我搜索的话搜索不到
      

  6.   

    或者把下面的注释了
    //#ifndef _AFX_NO_DB_SUPPORT
    //#include <afxdb.h>                      // MFC ODBC 数据库类
    //#endif // _AFX_NO_DB_SUPPORT
    //
    //#ifndef _AFX_NO_DAO_SUPPORT
    //#include <afxdao.h>                     // MFC DAO 数据库类
    //#endif // _AFX_NO_DAO_SUPPORT
      

  7.   

    我用的是ADO,没有上边的代码
      

  8.   

    #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
    这句代码,放在中下部分
      

  9.   

    这样就可以了,但是这个警告是什么意思呢,问题出在哪里\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned,指向程序中: adCreateStructDoc = -2147483648这一句
      

  10.   

    或者
    #pragma warning(disable:4146)
    ----------------------------------------------------------
    #import "c:\Program Files\common files\system\ado\msado20.tlb" no_namespace rename("EOF","adoEOF")
    ----------------------------------------------------------
    #pragma warning(default:4146)