急!!!ATL中添加mfc 的问题!!!
我在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
...... ...... ......
还望各位帮帮忙。多谢了!!!!
///////////////////////////////////////////
#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
...... ...... ......
还望各位帮帮忙。多谢了!!!!
...全文
相关推荐
duilibTreeView ATL WTL MFC 支持
《深入理解duilibTreeView:ATL、WTL与MFC的融合应用》在软件开发领域,用户界面(UI)的设计和实现至关重要。
如何在MFC中使用ATL控件
如果遇到问题,可以使用Visual Studio的调试工具进行调试,查看控件的状态和消息传递。以上就是如何在MFC中使用ATL控件的详细步骤。
ATL 封装MFC对话框
ATL工程会包含必要的COM基础设施,如导出接口、类工厂等。然后,你需要引入MFC库,这可以通过在ATL工程的属性设置中添加MFC支持来实现。
ATL组件开发及在MFC中的应用
以下是如何在MFC对话框中集成ATL组件的步骤:1. 添加ATL支持:在MFC项目中启用ATL支持,这可以通过在Visual Studio的项目属性中设置来完成。2.
分别用MFC和ATL创建COM组件
下面将详细介绍使用 MFC 和 ATL 创建 COM 组件的步骤和技术要点。一、使用 MFC 创建 COM 组件1.


