I've the following code snippet:
typedef unsigned long UINT32;
typedef struct
{
char str[128];
UINT32 mSec;
} SUB_SEQ_LINK;
I've got compilation error using VS2012/C++ to compile it:
D:\programs\ATP-3\ATP3MMI\MMI\Include\GlobalData.h(294): error C2371: 'UINT32' : redefinition; different basic types
1> C:\Program Files (x86)\Windows Kits\8.0\Include\shared\basetsd.h(76) : see declaration of 'UINT32'
But if I remove the line of "
typedef unsigned long UINT32;"
I've got error:
1>D:\programs\ATP-3\ATP3MMI\MMI\Include\GlobalData.h(299): error C2146: syntax error : missing ';' before identifier 'mSec'
1>D:\programs\ATP-3\ATP3MMI\MMI\Include\GlobalData.h(299): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
It's ridiculous. In the former case, it complained that I redefined UINT32, which is already defined at C:\Program Files (x86)\Windows Kits\8.0\Include\shared\basetsd.h, although I didn't find any inclusion in my codes for this header file.
In later case, it seems complaining that UINT32 is undefined.
What confuses me is that if I define UINT32 at my file, it complained I redefined it. If I remove UINT32 definition, it complained UINT32 is undefined term.
Anyone knows why and can help me how to do it?
What I have tried:
I googled the error message and found the explanation does not fit my situation. I examined my codes and I didn't find any inclusion for C:\Program Files (x86)\Windows Kits\8.0\Include\shared\basetsd.h. How come it comes into discussion?