usb setupapi.h(37) : error

来源:互联网 发布:淘宝扣分12分会怎么样 编辑:程序博客网 时间:2024/04/30 12:02
usb开发,网上教程各种错,
e:\vc98\include\setupapi.h(37) : error C2143: syntax error : missing ';' before '*'
e:\vc98\include\setupapi.h(37) : error C2501: 'LPGUID' : missing storage-class or type specifiers
e:\vc98\include\commctrl.h(26) : error C2146: syntax error : missing ';' before identifier 'HRESULT'
e:\vc98\include\commctrl.h(26) : fatal error C1004: unexpected end of file found

最终简单的改一下
#include <setupapi.h>
#include <stdio.h>

改成这样就可以了:

#include <windows.h>

#include <setupapi.h>
#include <stdio.h>

看来如果进行win32编译,前提是必须引进  windows.h 这个头文件。


过程编译出错

usb_test2.obj : error LNK2001: unresolved external symbol "unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@YGEPAXPAU_HIDD_ATTRIBUTES@@@Z)
usb_test2.obj : error LNK2001: unresolved external symbol "void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@YGXPAU_GUID@@@Z)
Debug/usb_test2.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

修改如下:

extern "C"{  //加上extern C
#include <hidsdi.h> 
#include <setupapi.h>  
#include <hidsdi.h>
}


0 0
原创粉丝点击