Pergunta

As the title suggests, I am having the following linker error:

error LNK2019: unresolved external symbol "unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@YGEPAXPAU_HIDD_ATTRIBUTES@@@Z)

when calling result = HidD_GetAttributes(WriteHandle, &attributes) in my code.

This function should exist in "hid.lib" which I have added to my linker dependencies for the project. I have also included the header file "hidsdi.h" which has the function prototype for HidD_GetAttributes.

The only other thing that I thought might be problematic is that the function prototypes for "hid.lib" are split between three different headers: hidsdi.h, hidpi.h, and hidsage.h.

Any suggestions?

Foi útil?

Solução

Just solved the problem. Apparently "hid.lib" was written in C which was resulting in some name mangling. Using

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

cleared everything up.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top