none
With 9200 WDK, the HID library can't be successfully linked. RRS feed

  • Question

  • I just got the 9200_WDK and found some problem on the new released WDK. I list what I did step by step.

    1. In a pure windows 8 O.S and install VS2012 Ultimate RC version.

    2. Install 9200_SDK first and 9200_WDK.

    3. Create a Win32 project.

    4. In the following function,  

    BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)

    I add the following code

    #include <windows.h>

    #include "hidsdi.h"

    GUID HidGuid;

    HidD_GetHidGuid(&HidGuid);

    5. In the project properties > Linker > Input > Additional Dependencies, I add "hid.lib"

    6. After all, build the project and got the error message.

    Error 1 error LNK2019: unresolved external symbol "void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@YGXPAU_GUID@@@Z) referenced in function I also try to specify the path of hid.lib by a direct link, like adding the whole path

    C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86\hid.lib

    Or copy the hid.lib file into the source code folder. But the error still happened.

    Is there something I forget to define or mis-understand? I can't build my own application to access HID device now.

    B.R

    Caro Lin

    Monday, December 24, 2012 9:51 AM

Answers

  • You need to wrap the #include of the hid header in an extern "C" block

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, December 24, 2012 4:30 PM

All replies

  • You need to wrap the #include of the hid header in an extern "C" block

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, December 24, 2012 4:30 PM
  • Thanks. It did work.

    extern "C"
    {
      #include "hidsdi.h"
    }

    Tuesday, December 25, 2012 12:57 AM