开发者

gcc error - typedef is initialized (use decltype instead)

开发者 https://www.devze.com 2023-01-19 02:30 出处:网络
I\'m compiling some C code, and I get the error typedef \'A\' is initialized (use decltype instead) 开发者_Python百科

I'm compiling some C code, and I get the error

typedef 'A' is initialized (use decltype instead)
开发者_Python百科

On one of my struct declarations. What could be causing this?


I am able to reproduce that with the simple program

typedef int A = 3;

typedef declares an alias to a type; it does not declare a variable. So if you want an instance of struct my_struct named A, you cannot also have typedef struct my_struct { ... } my_struct in the same declaration.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号