Question

I'm building UMDF Smart Card Reader Driver in Visual Studio. I get strange errors like that:

error C2374: 'GUID_DEVINTERFACE_DISK' : redefinition; multiple initialization C:\Program Files (x86)\Windows Kits\8.0\Include\UM\winioctl.h 43 1 BixVReader

File winioctl.h contains DEFINE_GUIDs for different devices like that (actually I have 1 error for each device here):

DEFINE_GUID(GUID_DEVINTERFACE_DISK, 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);

I suspect the line I wrote in Internal.h:

DEFINE_GUID(SmartCardReaderGuid, 0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30);

But what's wrong?

Was it helpful?

Solution

These errors dropped when I swaped #include "winioctl.h" and #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);

I'm not an expert in C++ and it seems strange to me, but still. Any comments on this issue are welcome.

OTHER TIPS

Apparently, the proper way to fix this is to #include <windows.h> before both winioctl.h and initguid.h. Doing so fixed the issue for me without having to swap the headers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top