救命啊,就写了个简单的COM 接口类就出现N多个错误
本人初学COM,对c++也不是很了解,只能说接触过,一直用C#开发的
就照着书写了接口类就出现N多个错误,求助大侠啊
#pragma once
class IMyUnknown
{
public:
virtual HRESULT _stdcall QueryInterface(const IID& iid, void * *ppv) = 0;
virtual ULONG _stdcall AddRef() = 0;
virtual ULONG _stdcall Release() =0;
};
错误信息:
e:\work project\test project\com\dictcomp\imyunknown.h(6) : error C2143: syntax error : missing ';' before '__stdcall'
e:\work project\test project\com\dictcomp\imyunknown.h(6) : error C2433: 'HRESULT' : 'virtual' not permitted on data declarations
e:\work project\test project\com\dictcomp\imyunknown.h(6) : error C2501: 'HRESULT' : missing storage-class or type specifiers
e:\work project\test project\com\dictcomp\imyunknown.h(6) : error C2143: syntax error : missing ',' before '&'
e:\work project\test project\com\dictcomp\imyunknown.h(6) : error C2059: syntax error : '&'
e:\work project\test project\com\dictcomp\imyunknown.h(6) : error C2253: 'QueryInterface' : pure specifier only applies to virtual function - specifier ignored
e:\work project\test project\com\dictcomp\imyunknown.h(7) : error C2143: syntax error : missing ';' before '__stdcall'
e:\work project\test project\com\dictcomp\imyunknown.h(7) : error C2433: 'ULONG' : 'virtual' not permitted on data declarations
e:\work project\test project\com\dictcomp\imyunknown.h(7) : error C2501: 'ULONG' : missing storage-class or type specifiers
e:\work project\test project\com\dictcomp\imyunknown.h(7) : error C2253: 'AddRef' : pure specifier only applies to virtual function - specifier ignored
e:\work project\test project\com\dictcomp\imyunknown.h(8) : error C2143: syntax error : missing ';' before '__stdcall'
e:\work project\test project\com\dictcomp\imyunknown.h(8) : error C2433: 'ULONG' : 'virtual' not permitted on data declarations
e:\work project\test project\com\dictcomp\imyunknown.h(8) : error C2501: 'ULONG' : missing storage-class or type specifiers
e:\work project\test project\com\dictcomp\imyunknown.h(8) : error C2253: 'Release' : pure specifier only applies to virtual function - specifier ignored
当然说白了这个3处错误都是同样的错误,但是本人愚钝就是找不出来