急!!!ATL中添加mfc 的问题!!!

jiayuxue jiayuxue 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在ATL中用到MFC的东西。所以在stdafx.h 中添加MFC的头文件
///////////////////////////////////////////
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
//
#include <afx.h>
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions

#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
///////////////////////////////////////////////

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

在网上查到,如果将#include <atlbase.h>放到afx头文件的后面可以避免这个问题。但是,如果我将atlbase.h放到上面代码的后面。就会出现更多错误:
error C2146: syntax error : missing ';' before identifier 'TheBaseClass'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2065: 'TheBaseClass' : undeclared identifier
...... ...... ......
还望各位帮帮忙。多谢了!!!!
...全文
评论 5
收藏 已收藏
分享
返回顶部
jiayuxue
VC/MFC 16,551 成员 421,605 内容