UPnP (once more): linking problems

Dear all,

I am writting an application for windows mobile in VC++ 2005 and when I compile my program, I get error LNK2001: unresolved external symbol IID_IUPnPDeviceFinder

and

unresolved external symbol CLSID_UPnPDeviceFinder

I included the "upnp.h" from UPnPctrl part of the MS Server Components but I get that error.

I have also included the path to upnp.h in the project properties.

I noticed that there is no .lib file included in the /lib directory of UPnPctrl part. do you think that this must be a problem

Any help will be really appreciated. Thank you in advance.

PS. The error comes up when I use the CoCreateInstance(CLSID_UPnPDeviceFinder, NULL, CLSCTX, IID_UPnPDeviceFinder, (void **) &finder); to create an instance of IUPnPDeviceFinder.




Answer this question

UPnP (once more): linking problems

  • HuWu

    Thank you so much for your quick reply. Unfortunately though, I'm developing for Pocket PC 2003, and the cab file under the upnp directory won't install.

    I have heard of programs that use UPnP running on this platform, so I'm hoping I just need a different install. I've been looking, but I really cannot find one anywhere.

    Can I bother you for this (hopefully) last piece of the puzzle


  • AlexBB

    Great! Ah well, thanks for letting me know.

    Do you know if I would be able to do this on this platform with the .NET framework I don't have any experience with .NET, but I'd give it a try if that was my only option (but I don't want to end up at a brickwall again!)


  • Gregor Jovan

    You need to include

    #include <initguid.h>

    before including upnp.h. Also keep in mind that this two includes should not go into stdafx.h, but rather into your .cpp file.

    And alternative is to use a construct like __uuidof(UPnPDeviceFinder) instead of CLSID_UPnPDeviceFinder



  • Drake1500

    OK, and I worked out that I can get the CLSID with __uuidof(UPnPDeviceFinder).

    When I run CoCreateInstance though, I now get an HRESULT indicating 'Class not registered'. Do I have to install UPnP dll's or something (and if so, where are they) I can't find any Pocket PC-specific UPnP documentation, and I've never used COM on one of these devices before, so sorry if I'm being an idiot...

    -A


  • Elia Ardizzoni

    In that case use __uuidof()

  • akin_l

    Hi Dj_Riduh and thank you for your reply.

    where exactly did u copy the files

    upnp_i.c and ipnp_p.c are these your application files

    Do you have any .lib files in your build path

    Sorry for the large number of questions.

    Thank you very much in advance.



  • Vesigo

    You need to install UPNP Control Point cab from this distirbution

  • Ashok VN

    Hello 147cuore!

    Try this:

    IUPnPDeviceFinder *m_pUPnPDeviceFinder;

    HRESULT hr;

    hr = CoCreateInstance(CLSID_UPnPDeviceFinder,NULL,CLSCTX_SERVER,IID_IUPnPDeviceFinder,(LPVOID *)&m_pUPnPDeviceFinder);

    if(hr!=S_OK) {
    AfxMessageBox(_T("CoCreateInstance failed for device finder object"));
    return FALSE;
    }

    m_pUPnPDeviceFinderCallback=new CUPnPDeviceFinderCallback();
    m_pUPnPDeviceFinderCallback->AddRef();

    [...]

    I copied the upnp.h, upnp.idl, upnp_i.c, upnp_p.c and upnp_h.h files to my application dir and it works well...

    Greetings,

    DJ_Riduh


  • srimal_s

    I'm trying to create a PocketPC UPnP app, and I'm having the same problem. I've tried various suggestions with no success.

    It doesn't look like UPnP.h uses the DEFINE_GUID macro that <initguid.h> defines - it explicitly declares them as extern's - so that doesn't help.

    I can use __uuid to manually #define the IID's, but what do I do for the CLSID But why would UPnP.h define the IID's to be extern's and then not provide a way to link to them I did find a bunch of IID's in a library called uuid.lib, but not the UPnP ones. Was this an oversight on MS's part


  • Wendell G

    [...]\Visual Studio workspace\SmartHomeCtrl\SmartHomeCtrl

    SmartHomeCtrl is my project name. All my .h and .cpp files are in this folder.

    upnp_i.c and upnp_p.c are generated by Visual Studio.

    There are no special .lib files in my build path.

    #include "upnp.h" //should be enough.

    I hope this helps. Feel free to ask more.


  • inbanco

    These components for WM2003 were never released separately. Unless your device OEM includes them in the build, you are out of luck. Sorry.

  • UPnP (once more): linking problems