RT ,写入类似下面的代码的时候 :#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( ).......................
总是报类似如下的错误 :error C2065: 'ObjectMap' : undeclared identifier
error 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' 啊...人家就是不报错...请教请教 ,这里到底是怎么回事,请求指点...求帮我改正错误...

解决方案 »

  1.   

    没加时报 :
    'ObjectMap' : undeclared identifier
    加了后报 :
    error C2065: '_Module' : undeclared identifier
      

  2.   

    c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(2945) : error C2065: '_Module' : undeclared identifier
      

  3.   

    #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>
      

  4.   

    #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>
      

  5.   

    知道了,要把
    CComModule   _Module;
    写在
    #include <atlcom.h>
    的上面........... =.=
      

  6.   

    BEGIN_OBJECT_MAP宏 从VS2008开始就取消了,不需要这个宏,ATL新版本采用另一种方式创建组件对象表,_Module全局变量也取消了,代之以 _AtlBaseModule/_AtlComModule...。你这个代码是早期制作的,必须修改。
      

  7.   

    那怎么会在 vs2010 的samples里面还有啊...
      

  8.   

    用VS2010编译6.0的代码,难勉有点麻烦,VS2002好像已经不用BEGIN_OBJECT_MAP,你试试是VS2005编译