wxwidgets 错误窗口.H 已包括在内

wxwidgets error WINDOWS.H already included

本文关键字:包括 错误 窗口 wxwidgets      更新时间:2023-10-16

我已经创建了简单的wxwidgets对话框(必须首先包含"wx/wxprec.h"),但也想重用另一个需要这些标头的应用程序的一些常见代码:

#include "wx/wxprec.h"
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include <afxsock.h>
#include <afxmt.h>

但后来我得到了这些错误:

c:program files (x86)microsoft visual studio 10.0vcatlmfcincludeafxv_w32.h(16): fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>

任何想法如何将这些MFC文件包含在wxwidgets项目中?

Hans Passant 的评论是正确的,如果必须同时使用 MFC 和 wxWidgets,则必须首先包含 MFC 标头。有关工作示例,请参阅 wxWidgets MFC 示例。