error: expected declaration specifiers or ‘…’ before ‘list_node’

ぃ、小莉子 提交于 2019-12-04 04:03:10

The error is this (from your comment):

I had an #include "parser.h" in the catalog.h. I removed it, and now it compiles normally...

Assuming that #include "parser.h" was before the typedef in catalog.h, and you have a source file that includes catalog.h before parser.h, then at the time the compiler includes parser.h, the typedef isn't available yet. It's probably best to rearrange the contents of the header files so that you don't have a circular dependency.

If this isn't an option, you can ensure that any source files that include these two files include parser.h first (or only).

Try this for catalog.h:

typedef struct node_struct {
     operationdesc op_ptr;
     struct node_struct* next;
} node;

typedef node* list_node;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!