Solved

error LNK2001: unresolved external symbol _CLSID_DccMan????

Posted on 2004-10-10
15
668 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:LukaKrop
  • 8
  • 7
15 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 12273397
Have you tried to

#define INITGUID

before including the COM headers?
0
 

Author Comment

by:LukaKrop
ID: 12273400
Yes, but same result
0
 
LVL 86

Expert Comment

by:jkr
ID: 12278541
0
 

Author Comment

by:LukaKrop
ID: 12279162
If I use /VERBOSE:LIB  switch I see that it uses bot lib files...
0
 
LVL 86

Expert Comment

by:jkr
ID: 12279199
Hmm, are you sure you're including the header files like

#define INITGUID
#include <Dccole.h>
0
 

Author Comment

by:LukaKrop
ID: 12279310
I have already tried this but the same 4 link errors
0
 
LVL 86

Expert Comment

by:jkr
ID: 12279380
Sorry, that should have been

#define INITGUID
#include <initguid.h>
#include <objbase.h>
#include <Dccole.h>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:LukaKrop
ID: 12279421
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
 
LVL 86

Expert Comment

by:jkr
ID: 12279540
>>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
 

Author Comment

by:LukaKrop
ID: 12279630
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
 
LVL 86

Expert Comment

by:jkr
ID: 12279651
>>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
 

Author Comment

by:LukaKrop
ID: 12279680
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
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 12279792
Yes, but what about moving that to the .cpp files and only *one* having 'INITGUID' defined?
0
 

Author Comment

by:LukaKrop
ID: 12279822
Man great that worked

Great job

thank you thank you thank you

0
 
LVL 86

Expert Comment

by:jkr
ID: 12279848
You're welcome :o)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
lucky13 challenge 11 123
matchUp  challenge 9 94
mapAB Challlenge 35 126
Way to decrease size of apk file 9 45
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now