现在的位置: 首页 > 综合 > 正文

‘HDEVNOTIFY’ : missing storage-class or type specifiers

2014年02月27日 ⁄ 综合 ⁄ 共 433字 ⁄ 字号 评论关闭

由于要响应设备的插拔,所有要注册设备的事件通知,用到'HDEVNOTIFY' 等的时侯,编译出现了莫名奇妙的错误:

error C2146: syntax error : missing ';' before identifier 'm_hDevNotify'

error C2501: 'HDEVNOTIFY' : missing storage-class or type specifiers

error C2065: 'UnregisterDeviceNotification' : undeclared identifier

error C2065: 'DEV_BROADCAST_DEVICEINTERFACE' : undeclared identifier

error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier

 

后在MSDN上找到答案,只要在stdafx.h的开始定义WINVER大于0x0500即可:

例如: #define WINVER 0x0501

抱歉!评论已关闭.