MinGW

解決"undefined reference to HidD_GetHidGuid(_GUID*)@4"問題


問題如下:

/tmp/ccwY1RCQ.o:main.cpp:(.text+0x25): undefined reference to `HidD_GetHidGuid(_GUID*)@4'
/tmp/ccwY1RCQ.o:main.cpp:(.text+0x262): undefined reference to `HidD_GetAttributes(void*, _HIDD_ATTRIBUTES*)@8'
collect2: error: ld returned 1 exit status

解法如下:

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

P.S. LDFlags則需要加上-lhid


返回上一頁