locked
WDK build environment setup for HID client support RRS feed

  • Question

  • Hi!

    I'm currently trying to write a client application that interacts with USB-Human Interface Device (HID) hardware with VC++. The HID library is part of the Windows Driver Kit (WDK), of which I installed the latest version. Since the latest WDK version needs Platform SDK 7, I'm currently using Visual Studio 2010 RC1 for testing. My system is WinXP 64 Bit Edition.

    My problem is, I cannot get to my application to link correctly. I've created an empty Win32 Console Application for testing purposes and added a single .cpp file which includes Hidsdi.h from WDK/inc/api. As a test I was trying to call HidD_GetHidGuid() (http://msdn.microsoft.com/en-us/library/ms790927.aspx). As suggested by the documentation, I linked to hdi.lib in WDK/lib/wxp/i386.

    However, the linker complains he cannot find the function:

    error LNK2019: unresolved external symbol "void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@YGXPAU_GUID@@@Z) referenced in function _main

    I checked the referenced hid.lib file with a Hex Editor and it definitely contains symbols for the functions. Any ideas what I might be missing here?

    Thanks.

    Monday, March 29, 2010 9:29 AM

Answers

  • Arrgh, stupid me.

    I simply forgot to wrap the WDK #includes in

    extern "C" {
    }

     

    Sorry for the noise. :(

     

    • Marked as answer by Andreas Weis Monday, March 29, 2010 10:27 AM
    Monday, March 29, 2010 9:43 AM
  • > However, the linker complains he cannot find the function:
    >
    > error LNK2019: unresolved external symbol "void __stdcall
    > HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@YGXPAU_GUID@@@Z)
    > referenced in function _main

    That looks like it's a function defined as C++. Presumably the WDK stuff
    is meant for 'C' usage - in which case you probably need to use extern
    "C" around the external definition of the function.

    Dave
    • Marked as answer by Andreas Weis Monday, March 29, 2010 10:27 AM
    Monday, March 29, 2010 10:04 AM

All replies

  • Arrgh, stupid me.

    I simply forgot to wrap the WDK #includes in

    extern "C" {
    }

     

    Sorry for the noise. :(

     

    • Marked as answer by Andreas Weis Monday, March 29, 2010 10:27 AM
    Monday, March 29, 2010 9:43 AM
  • > However, the linker complains he cannot find the function:
    >
    > error LNK2019: unresolved external symbol "void __stdcall
    > HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@YGXPAU_GUID@@@Z)
    > referenced in function _main

    That looks like it's a function defined as C++. Presumably the WDK stuff
    is meant for 'C' usage - in which case you probably need to use extern
    "C" around the external definition of the function.

    Dave
    • Marked as answer by Andreas Weis Monday, March 29, 2010 10:27 AM
    Monday, March 29, 2010 10:04 AM
  • Dear DerGhulbus,

    I'm writing the same kind of software.

    Is it possible to obtain your sample projet solution ?

    I would like to see if i can build your code with my own vs2010 and winddk because my own project still not build.

    Best regards,

     

    Gaël

     

    Thursday, March 31, 2011 1:36 AM