vs 2005错误LNK2001:未解析的外部符号(2)

时间:2012-06-28 12:33:23

标签: com visual-c++ lnk2001

“public:virtual long __stdcall PCI1761Event :: GetTypeInfoCount(unsigned int *)”(?GetTypeInfoCount @ PCI1761Event @@ UAGJPAI @ Z)

类PCI1761Event:
    public CComObjectRoot,
    public _IAdvDIOEvents
{

公共:
    BEGIN_COM_MAP(PCI1761Event)
        COM_INTERFACE_ENTRY(_IAdvDIOEvents)
    END_COM_MAP()

PCI1761Event(void);<br>

HRESULT  OnDiInterrupt (
    long channel,
    VARIANT * data,
    long scanStart,
    long scanCount );<br>

HRESULT OnDiStatusChange (
    long port,
    VARIANT * data,
    long scanStart,
    long scanCount );<br>

HRESULT OnDiPatternMatch (
    long port,
    VARIANT * data,
    long scanStart,
    long scanCount );<br>

HRESULT OnDeviceRemoved (
    long DeviceNumber );
  HRESULT STDMETHODCALLTYPE GetTypeInfoCount( 
        /* [out] */ UINT *pctinfo) ;<br>

     HRESULT STDMETHODCALLTYPE GetTypeInfo( 
        /* [in] */ UINT iTInfo,
        /* [in] */ LCID lcid,
        /* [out] */ ITypeInfo **ppTInfo) ;

    HRESULT STDMETHODCALLTYPE GetIDsOfNames( 
        /* [in] */ REFIID riid,
        /* [size_is][in] */ LPOLESTR *rgszNames,
        /* [in] */ UINT cNames,
        /* [in] */ LCID lcid,
        /* [size_is][out] */ DISPID *rgDispId) ;

    /* [local] */ HRESULT STDMETHODCALLTYPE Invoke( 
        /* [in] */ DISPID dispIdMember,
        /* [in] */ REFIID riid,
        /* [in] */ LCID lcid,
        /* [in] */ WORD wFlags,
        /* [out][in] */ DISPPARAMS *pDispParams,
        /* [out] */ VARIANT *pVarResult,
        /* [out] */ EXCEPINFO *pExcepInfo,
        /* [out] */ UINT *puArgErr) ;

公共:     〜PCI1761Event(无效); };

为什么????

1 个答案:

答案 0 :(得分:1)

因为您尝试实现的_IAdvDIOEvents接口来自IDispatch,因此您必须在类上实现IDispatch方法。在ATL中,您通常从IDispatchImpl<_IAdvDIOEvents, ...>类继承您的类,以便为您实现menthod。