error LNK2001: unresolved external symbol _CLSID_DccMan????

Hello

I don't know what to do. I tried everything and nothing helps.
I am trying to implement in my app IDccMan and IDccManSkin to get notified if my PDA get connected. Both are part of ActiveSync connection manager.

the included file in my project is
#include "dccole.h"

links form microsoft.com is
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/_wcesdk_IDccMan_IUnknown.asp

thank you very much for your help
LukaKropAsked:
Who is Participating?
 
jkrCommented:
Yes, but what about moving that to the .cpp files and only *one* having 'INITGUID' defined?
0
 
jkrCommented:
Have you tried to

#define INITGUID

before including the COM headers?
0
 
LukaKropAuthor Commented:
Yes, but same result
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
jkrCommented:
0
 
LukaKropAuthor Commented:
If I use /VERBOSE:LIB  switch I see that it uses bot lib files...
0
 
jkrCommented:
Hmm, are you sure you're including the header files like

#define INITGUID
#include <Dccole.h>
0
 
LukaKropAuthor Commented:
I have already tried this but the same 4 link errors
0
 
jkrCommented:
Sorry, that should have been

#define INITGUID
#include <initguid.h>
#include <objbase.h>
#include <Dccole.h>
0
 
LukaKropAuthor Commented:
now I have 19 errors

Linking...
DPDA.obj : error LNK2005: _CLSID_DccMan already defined in ChildFrm.obj
DPDA.obj : error LNK2005: _IID_IDccMan already defined in ChildFrm.obj
DPDA.obj : error LNK2005: _IID_IDccManSink already defined in ChildFrm.obj
DPDADoc.obj : error LNK2005: _CLSID_DccMan already defined in ChildFrm.obj
DPDADoc.obj : error LNK2005: _IID_IDccMan already defined in ChildFrm.obj
DPDADoc.obj : error LNK2005: _IID_IDccManSink already defined in ChildFrm.obj
DPDAView.obj : error LNK2005: _CLSID_DccMan already defined in ChildFrm.obj
DPDAView.obj : error LNK2005: _IID_IDccMan already defined in ChildFrm.obj
DPDAView.obj : error LNK2005: _IID_IDccManSink already defined in ChildFrm.obj
MainFrm.obj : error LNK2005: _CLSID_DccMan already defined in ChildFrm.obj
MainFrm.obj : error LNK2005: _IID_IDccMan already defined in ChildFrm.obj
MainFrm.obj : error LNK2005: _IID_IDccManSink already defined in ChildFrm.obj
MySinkObject.obj : error LNK2005: _CLSID_DccMan already defined in ChildFrm.obj
MySinkObject.obj : error LNK2005: _IID_IDccMan already defined in ChildFrm.obj
MySinkObject.obj : error LNK2005: _IID_IDccManSink already defined in ChildFrm.obj
Splash.obj : error LNK2005: _CLSID_DccMan already defined in ChildFrm.obj
Splash.obj : error LNK2005: _IID_IDccMan already defined in ChildFrm.obj
Splash.obj : error LNK2005: _IID_IDccManSink already defined in ChildFrm.obj
Debug/DPDA.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

DPDA.exe - 19 error(s), 0 warning(s)
0
 
jkrCommented:
>>CLSID_DccMan already defined

Aaah, there we have it :o)

Try

#ifndef INITGUID
#define INITGUID
#endif
#include <initguid.h>
#include <objbase.h>
#include <Dccole.h>
0
 
LukaKropAuthor Commented:
I get the same 19 Link errors

let me show you my implementation

OK first my derived code from IDccManSink class

class CMySinkObject : public IDccManSink  
{
public:
     CMySinkObject();
     ~CMySinkObject();
// IUnknown methods:
   STDMETHODIMP_(DWORD) AddRef(void);
   STDMETHODIMP QueryInterface(REFIID riid, void ** ppv);
   STDMETHODIMP_(DWORD) Release(void);
     // IDccManSink methods;
   STDMETHODIMP OnLogAnswered(void);
   STDMETHODIMP OnLogActive(void);
   STDMETHODIMP OnLogDisconnection(void);
   STDMETHODIMP OnLogError(void);
   STDMETHODIMP OnLogInactive(void);
   STDMETHODIMP OnLogIpAddr(DWORD dwIpAddr);
   STDMETHODIMP OnLogListen(void);
   STDMETHODIMP OnLogTerminated(void);
private:
   DWORD m_dwRefCount;
};

and implementation

#include "stdafx.h"
#include "DPDA.h"
#include "MySinkObject.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMySinkObject::CMySinkObject()
{

}

CMySinkObject::~CMySinkObject()
{
     
}

STDMETHODIMP CMySinkObject::OnLogAnswered(void)
{
     AfxMessageBox(_T("OnLogAnswered"));
     return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogActive(void)
{
     AfxMessageBox(_T("OnLogActive"));
     return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogDisconnection(void)
{
     AfxMessageBox(_T("OnLogDisconnection"));
     return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogError(void)
{
     AfxMessageBox(_T("OnLogError"));
     return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogInactive(void)
{
     AfxMessageBox(_T("OnLogInactive"));
     return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogIpAddr(DWORD dwIpAddr)
{
     AfxMessageBox(_T("OnLogIpAddr"));
     return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogListen(void)
{
     AfxMessageBox(_T("OnLogListen"));
     return NOERROR;
}    

STDMETHODIMP CMySinkObject::OnLogTerminated(void)
{
     AfxMessageBox(_T("OnLogTerminated"));
     return NOERROR;
}


STDMETHODIMP_(DWORD) CMySinkObject::AddRef(void)
{
  return ++m_dwRefCount;

}
STDMETHODIMP CMySinkObject::QueryInterface(REFIID riid, void ** ppv)
{
    if( IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDccManSink))
    {
        *ppv = (IDccManSink *)this;
    }
    else
    {
        *ppv = NULL;
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
}
STDMETHODIMP_(DWORD) CMySinkObject::Release(void)
{
    ULONG   ul = m_dwRefCount;

    if (!--m_dwRefCount)
        delete this;

    return ul;
}

in App derived class I added variable members:

DWORD m_hrDccMan;
IDccMan* pDccMan;
HRESULT hr;
CMySinkObject m_mySkin;


in application I add to InitInstance() code:

hr = CoCreateInstance(CLSID_DccMan, NULL, CLSCTX_INPROC_SERVER, IID_IDccMan, (LPVOID*) &pDccMan);
pDccMan->Advise((CMySinkObject*)&m_mySkin, &m_hrDccMan);

and in ExitInstance I added:

pDccMan->Unadvise(m_hrDccMan);


0
 
jkrCommented:
>>let me show you my implementation

That's not the problem. The important part is that only *one* source file must '#define INITGUID', so if you place that line in a common header file, you'll get al these 'multiply defines' errors.
0
 
LukaKropAuthor Commented:
I have already tried what you suggest

#ifndef INITGUID
#define INITGUID
#endif
#include <initguid.h>
#include <objbase.h>
#include <Dccole.h>

but the same 19 errors
0
 
LukaKropAuthor Commented:
Man great that worked

Great job

thank you thank you thank you

0
 
jkrCommented:
You're welcome :o)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.