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,

typedef struct {
key_t xyz;

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 :10858

Tags: , , , ,

  1. #1 written by Koby August 1st, 2019 at 19:32

    Hi, I do think this is aan excellent web site.
    I syumbledupon it 😉 I am ging to return yyet again since i
    hhave bookmarked it. Money and freedom is the
    best way to change, may yyou be rich and continue too guide other people.

    RE Q

Content Protected Using Blog Protector By: PcDrome.