Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 277
Aman Deep Gautam Avatar asked Aug 05 '26 12:08

Aman Deep Gautam


1 Answers

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;
like image 155
TJD Avatar answered Aug 08 '26 03:08

TJD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!