Solved

error LNK2001: unresolved external symbol _CLSID_DccMan????

Posted on 2004-10-10
15
675 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

628 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