2

我有一个使用 SQL Compact Server 的 Visual Studio 6.0 项目。我正在尝试更新在 Visual Studio 2012 上使用的解决方案,但出现以下错误:

fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>

我的 stdafx.h 包括 winsock2.h,他有这个:

#ifndef _INC_WINDOWS
#include <windows.h>
#endif /* _INC_WINDOWS */

有没有办法抑制错误?我该如何进行?当我删除间接包含它的文件的 windows.h 时,我得到了error C2011: 'IRowsetBookmark' : 'struct' type redefinition

我已经在这里看到了有关此错误的其他问题,但没有任何建议对我有用。


- 更新:

我解决了error C2011: 'IRowsetBookmark' : 'struct' type redefinition在 stdafx.h 顶部添加以下行的问题:

#if !defined(__IRowsetBookmark_INTERFACE_DEFINED__)
#define __IRowsetBookmark_INTERFACE_DEFINED__
#endif

#if !defined(__IRowsetBookmark_FWD_DEFINED__)
#define __IRowsetBookmark_FWD_DEFINED__
#endif

但我error C2143: syntax error : missing ',' before '<' 在那些线上:

class CArrayRowset :
    public CVirtualBuffer<T>,
    public TRowset
{

是否有可能在我的 stdfx.hi 上添加这些行会弄乱一些类声明?

4

1 回答 1

1

尝试在包含 winsock2.h 之前定义 _INC_WINDOWS 以取消包含 win.h

于 2014-03-21T18:32:01.403 回答