我正在将一个项目从VS2008升级到VS2013。我遇到了以下错误(以及后面的许多其他错误,但这是第一个问题):
1>d:\express\ver38\ide\source\aimauto\AimConfiguration.h(12): error C2504: 'IDispatchImpl' : base class undefined
1>d:\express\ver38\ide\source\aimauto\AimConfiguration.h(12): error C2143: syntax error : missing ',' before '<'
1>d:\express\ver38\ide\source\aimauto\AimConfiguration.h(32): error C3646: 'COM_INTERFACE_ENTRY' : unknown override specifier
1>d:\express\ver38\ide\source\aimauto\AimConfiguration.h(32): error C2259: 'IDispatch' : cannot instantiate abstract class
1> due to following members:
1> 'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\unknwnbase.h(114) : see declaration of 'IUnknown::QueryInterface'
1> 'ULONG IUnknown::AddRef(void)' : is abstract
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\unknwnbase.h(118) : see declaration of 'IUnknown::AddRef'
1> 'ULONG IUnknown::Release(void)' : is abstract
1> C:\Program Files (x86)\Windows Kits\8.1\Include\um\unknwnbase.h(120) : see declaration of 'IUnknown::Release'
1> 'HRESULT IDispatch::GetTypeInfoCount(UINT *)' : is abstract
1> c:\program files (x86)\windows kits\8.1\include\um\oaidl.h(2187) : see declaration of 'IDispatch::GetTypeInfoCount'
1> 'HRESULT IDispatch::GetTypeInfo(UINT,LCID,ITypeInfo **)' : is abstract
1> c:\program files (x86)\windows kits\8.1\include\um\oaidl.h(2190) : see declaration of 'IDispatch::GetTypeInfo'
1> 'HRESULT IDispatch::GetIDsOfNames(const IID &,LPOLESTR *,UINT,LCID,DISPID *)' : is abstract
1> c:\program files (x86)\windows kits\8.1\include\um\oaidl.h(2195) : see declaration of 'IDispatch::GetIDsOfNames'
1> 'HRESULT IDispatch::Invoke(DISPID,const IID &,LCID,WORD,DISPPARAMS *,VARIANT *,EXCEPINFO *,UINT *)' : is abstract
1> c:\program files (x86)\windows kits\8.1\include\um\oaidl.h(2202) : see declaration of 'IDispatch::Invoke'头文件AimConfiguration.h中的代码为:
class aimConfiguration :
public IDispatchImpl<IaimConfiguration, &IID_IaimConfiguration, &LIBID_aimAutomationLib,AIM_MAJOR_VER,AIM_MINOR_VER>,
public ISupportErrorInfo,
public CComObjectRoot,
public CComCoClass<aimConfiguration,&CLSID_aimConfiguration>atlcom.h在cpp文件中声明:
#include "stdafx.h"
#include "atlcom.h"
#include "aimAutomation.h"
#include "AimStrings.h"
#include "AimConfiguration.h"我在搜索时发现了类似问题的引用,但我没有找到解决方案。谢谢你的帮助。
发布于 2016-12-09 06:14:33
大多数ATL内容都在ATL名称空间中。我认为生成的stdafx.h定义了_ATL_NO_AUTOMATIC_NAMESPACE,因此您需要删除#define或使用using namespace ATL; (对于.cpp文件是首选的),或者使用ATL::显式限定接口和内容(对于头文件是首选的)。
https://stackoverflow.com/questions/41049617
复制相似问题