初学ATL,BEGIN_OBJECT_MAP 搞不定 ?解决方案
初学ATL,BEGIN_OBJECT_MAP 搞不定 ??RT ,写入类似下面的代码的时候 :C/C++ code#include stdio.h//#incl
初学ATL,BEGIN_OBJECT_MAP 搞不定 ??
RT ,写入类似下面的代码的时候 :
C/C++ code#include <stdio.h>//#include <windows.h>#include <tchar.h>#include <afx.h> #include <atlbase.h> CComModule _Module;BEGIN_OBJECT_MAP(ObjectMap) OBJECT_ENTRY(CLSID_MyCircleCollectionCreator, CMyCircleCollectionCreator)END_OBJECT_MAP( ).......................
总是报类似如下的错误 :
XML codeerror C2065: 'ObjectMap' : undeclared identifiererror C2501: 'BEGIN_OBJECT_MAP' : missing storage-class or type specifiers......
她说 ObjectMap 未定义.....
我调试了 vs2010 的例子代码:
C:\Program Files\Microsoft Visual Studio 10.0\Samples\2052\VC2010Samples\C++\Language\Events\MEDriver\MEDriver.sln (调试OK)
我找了一下,也没有地方 声明 'ObjectMap' 啊...人家就是不报错...
请教请教 ,这里到底是怎么回事,请求指点...求帮我改正错误...
[解决办法]#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
CComModule _Module;
#include <atlcom.h>
[解决办法]BEGIN_OBJECT_MAP宏 从VS2008开始就取消了,不需要这个宏,ATL新版本采用另一种方式创建组件对象表,_Module全局变量也取消了,代之以 _AtlBaseModule/_AtlComModule...。你这个代码是早期制作的,必须修改。