Visual C++ Compiler ERROR C2016
Compiling a C file with Visual Studio 2008 compiler I got this error:
"error C2016: C requires that a struct or union has at least one member"
I am writing this post because it is not documented, and C2016 on MSDN is defined as "A newline character was found before the closing single quotation mark of a character constant". Either it is not well documented or I don't know where to look for it. Whatever the reason I can only guess that someone else will find the same problem.
This is the cause:
struct
{
int u8Type;
int u8LenExtended;
int u16Length;
} Base_Request;
struct Request_Ex
{
Base_Request Request;
int Address;
int Length;
};
This is the fix:
typedef struct
{
int u8Type;
int u8LenExtended;
int u16Length;
} Base_Request;
struct Request_Ex
{
Base_Request Request;
int Address;
int Length;
};
This is over simplified intentionally.
Asaf