HyperEngineer
Programmer
I created a new project in VC2008. I added nothing to the code except these statements:
When I build it I get these errors in the usb200.h file:
error C2332: 'struct':missing tag name
error C2011:'<unnamed-tag>':'enum' type redefinition
error C2059:syntax error:'constant'
error C2334: unexpectoed token(s) preceding '{'; skipping apparent function body
These all apply to line 91 of usb200.h. This is the code:
Line 91 is: struct _MP {.
I have the same code in another project that works fine. I don't remember if I had to do anything else to make it work.
Thanks,
HyperEngineer
If it ain't broke, it probably needs improvement.
Code:
extern "C" {
#include <usb.h>
#include <usbiodef.h>
#include <usbioctl.h>
#include <usbprint.h>
#include <setupapi.h>
#include <devguid.h>
#include <wdmguid.h>
#include <InitGuid.h>
}
/*
This define is required so that the GUID_DEVINTERFACE_USBPRINT variabl is
declared and intialized as static locally, since windows does not
include it in any of its libraries.
*/
#define SS_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
static const GUID name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}
// SS_DEFINE_GUID(GUID_DEVINTERFACE_USBPRINT, 0x4d36e979, 0xe325, 0x11ce, 0xbf,
// 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18);
SS_DEFINE_GUID(GUID_DEVINTERFACE_USBPRINT, 0x28d78fad, 0x5a12, 0x11d1, 0xae,
0x5b, 0x00, 0x00, 0xf8, 0x03, 0xa8, 0xc2);
/*
Identifier GUID_DEVINTERFACE_USB_DEVICE
Class GUID {A5DCBF10-6530-11D2-901F-00C04FB951ED}
*/
//#define SS_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
// static const GUID name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}
SS_DEFINE_GUID(GUID_DEVINTERFACE_USBDEVICE, 0xa5dcbf10, 0x6530, 0x11d2, 0x90,
0x1f, 0x00, 0xc0, 0x4f, 0xb9, 0x51, 0xed);
When I build it I get these errors in the usb200.h file:
error C2332: 'struct':missing tag name
error C2011:'<unnamed-tag>':'enum' type redefinition
error C2059:syntax error:'constant'
error C2334: unexpectoed token(s) preceding '{'; skipping apparent function body
These all apply to line 91 of usb200.h. This is the code:
Code:
typedef union _USB_HIGH_SPEED_MAXPACKET {
struct _MP {
USHORT MaxPacket:11; /* 0..10 */
USHORT HSmux:2; /* 11..12 */
USHORT Reserved:3; /* 13..15 */
};
USHORT us;
} USB_HIGH_SPEED_MAXPACKET, *PUSB_HIGH_SPEED_MAXPACKET;
Line 91 is: struct _MP {.
I have the same code in another project that works fine. I don't remember if I had to do anything else to make it work.
Thanks,
HyperEngineer
If it ain't broke, it probably needs improvement.