suigara
suigara

Reputation: 35

vs 2005 error LNK2001: unresolved external symbol (2)

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

Code

class PCI1761Event :
public CComObjectRoot,
public _IAdvDIOEvents
{

public:
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) ;

public: ~PCI1761Event(void); };

Why????

Upvotes: 0

Views: 193

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69662

Because _IAdvDIOEvents inteface you are trying to implement is derived from IDispatch and thus you have to implement IDispatch methods on your class too. In ATL you typically inherit your class from IDispatchImpl<_IAdvDIOEvents, ...> class to have the menthods implemented for you.

Upvotes: 1

Related Questions