简体   繁体   English

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

[英]vs 2005 error LNK2001: unresolved external symbol (2)

"public: virtual long __stdcall PCI1761Event::GetTypeInfoCount(unsigned int *)" (?GetTypeInfoCount@PCI1761Event@@UAGJPAI@Z) “公共:虚拟长__stdcall PCI1761Event :: GetTypeInfoCount(unsigned int *)”(?GetTypeInfoCount @ PCI1761Event @@ UAGJPAI @ Z)

Code

class PCI1761Event : 类PCI1761Event:
public CComObjectRoot, 公共CComObjectRoot,
public _IAdvDIOEvents 公共_IAdvDIOEvents
{ {

public: 上市:
BEGIN_COM_MAP(PCI1761Event) BEGIN_COM_MAP(PCI1761事件)
COM_INTERFACE_ENTRY(_IAdvDIOEvents) COM_INTERFACE_ENTRY(_IAdvDIOEvents)
END_COM_MAP() 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) ;

public: ~PCI1761Event(void); 公共:〜PCI1761Event(void); }; };

Why???? 为什么????

Because _IAdvDIOEvents inteface you are trying to implement is derived from IDispatch and thus you have to implement IDispatch methods on your class too. 因为您要实现的_IAdvDIOEvents接口是从IDispatch派生的,所以您也必须在类上实现IDispatch方法。 In ATL you typically inherit your class from IDispatchImpl<_IAdvDIOEvents, ...> class to have the menthods implemented for you. 在ATL中,您通常从IDispatchImpl<_IAdvDIOEvents, ...>类继承您的类,以为您实现方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM