Solution – C Requires That a Struct Or Union Has At Least One Member

Windows errors are strange,
I have one header file in which one structure is declared,
as

typedef struct {
key_t xyz;
——
}INFO;

For this When I compile using cl.exe I get following list of errors.

: error C2016: C requires that a struct or union has at least one member
: error C2061: syntax error : identifier 'key_t'
: error C2059: syntax error : '}'

Well I am doing Code migration from Unix system to Windows system so key_t is not known in windows.

It does not make sense for the

Compiler Error C2016

which says no closing single quotation mark. Scratching my head and going around with the error.
I do not see any mistake in struct declaration,
Solution – C requires that a struct or union has at least one member
Just add the declaration of key_t in same header file before structure declaration.

typedef int key_t;

And compile again you are done.

Number of View :2292

Tags: , , , ,

  1. No comments yet.

SetPageWidth
Content Protected Using Blog Protector By: PcDrome.

Mahol Dot Org is Stephen Fry proof thanks to caching by WP Super Cache