Solved

error LNK2001: unresolved external symbol _CLSID_DccMan????

Posted on 2004-10-10
15
667 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video discusses moving either the default database or any database to a new volume.

705 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

20 Experts available now in Live!

Get 1:1 Help Now