error: expected specifier-qualifier-list before xxx (a structure )

来源:互联网 发布:spark mail windows 编辑:程序博客网 时间:2024/05/21 06:14

when I try to define a LIST_NODE structure in a my code,
it's alert "error: expected specifier-qualifier-list before LIST_NODE", which following so many error info:

error: ‘LIST_NODE’ has no member named ‘next’error: ‘LIST_NODET’ has no member named ‘previous’error: ‘LIST_NODE’ has no member named ‘previous’

I was astonished for a minutes:


typedef struct LIST_NODE{   void   *data;   LIST_NODE   *next;   LIST_NODE   *previous;} LIST_NODE;


yeah, I found the error!
the structure is unnamed yet. I should gave it name so it can refer to itself
modified as follow, then erverthing would be ok:


typedef struct LIST_NODE{   void   *data;   struct LIST_NODE   *next;   struct LIST_NODE   *previous;} LIST_NODE;


good luck!