我正在Visual Studio中构建UMDF智能卡读卡器驱动程序。我得到了类似的奇怪错误:
error C2374: 'GUID_DEVINTERFACE_DISK' : redefinition; multiple initialization C:\Program Files (x86)\Windows Kits\8.0\Include\UM\winioctl.h 43 1 BixVReader
文件winioctl.h包含不同设备的DEFINE_GUID(实际上每个设备有1个错误):
DEFINE_GUID(GUID_DEVINTERFACE_DISK, 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
我怀疑我在Internal.h中写的那行:
DEFINE_GUID(SmartCardReaderGuid,
0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30);
但是怎么了?
答案 0 :(得分:3)
当我转换 #include“winioctl.h”和 #include 时,这些错误就会丢失:
//
// Windows IOCTL definitions.
//
#include "winioctl.h"
//
// GUID include
//
#include <initguid.h>
//
// Device Interface GUID
// 0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30
//
DEFINE_GUID(GUID_DEVINTERFACE_BixVReader,
0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30);
我不是C ++专家,对我来说似乎很奇怪,但仍然如此。欢迎就此问题发表任何意见。