【发布时间】:2016-05-17 08:37:31
【问题描述】:
我创建了简单的 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.0\vc\atlmfc\include\afxv_w32.h(16): fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
任何想法如何将这些 MFC 文件包含在 wxwidgets 项目中?
【问题讨论】:
-
改变#includes的顺序,afxwin.h需要在前。做同样事情的两个不同的类库是否能有一个好的结局,嗯,也许吧。可能很大。
-
感谢您的回复。好吧,wxWidgets 需要在 windows.h 之前包含 wx.h 或 wxprec.h,所以似乎我应该避免在 wxwidgets 项目中使用基于 mfc 的代码,并且应该使用 wxWidgets 重新实现该功能。