【发布时间】:2014-04-29 06:49:04
【问题描述】:
我有一个使用 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.h 中添加这些行我搞砸了一些类声明?
【问题讨论】:
-
基于this,在包含
winsock2.h之前不包含afx.h或afxwin.h可能解决问题吗? -
这样我得到了错误 C2011: 'IRowsetBookmark' : 'struct' type redefinition that I提到
-
至于C2143,我想应该是无关的吧,前面不是有:
error C2504: 'CVirtualBuffer' : base class undefined吗?这意味着您必须包含定义它的文件,至少在 VS2013 上,它似乎是atldbcli.h。 -
这个错误发生在 atldbcli_ce.h
标签: c++ visual-studio-2010 mfc sql-server-ce stdafx.h