Aman Deep Gautam
Aman Deep Gautam

Reputation: 8737

warning: useless type name in empty declaration

I have a project and two files in the project are named as query-structures.h query-structures.c. Contents in the query-structures.h are

#include <stdint.h>
typedef struct user_identifier user_identifier;
extern user_identifier;

and in query-structures.c are

#include "query-structures.h"
struct user_identifier
{
    uint64_t user_id;
};

Now the Compiler is giving me a warning as

warning: useless type name in empty declaration [enabled by default]

I cannot understand why this warning is there because I have to use this struct in other files of my project.

Upvotes: 3

Views: 12063

Answers (1)

TJD
TJD

Reputation: 11896

This line is abnormal because you declare a type but no variable name

extern user_identifier;

For example, with ints, you would write

extern int x;

not

  extern int;

Upvotes: 10

Related Questions