我有这个错误:预期的声明说明符或 '...' 前 'list_node'
typedef struct node* list_node;
struct node
{
operationdesc op_ptr;
list_node next;
};
一个catalog.h文件和parser.h这个
#include "catalog.h"
int parse_query(char *input, list_node operation_list);
两个头有#ifndef
,#define
,#endif
。 编译器给了我这个错误:parse_query行上的expected declaration specifiers or ‘...’ before ‘list_node’
。 什么事情? 我试图把typedef放在parser.h中,并没有问题。为什么当typedef位于catalog.h中时会出现此错误?
实际上,我在catalog.h中有一个#include“parser.h”。我删除它,现在它编译通常...我想它试图加载parse_query定义之前的typedef和结构定义..? – pvinis 2011-02-15 08:48:04
catalog.h中的#ifndef究竟是什么样的?尝试cc -E查看预处理器输出,以查看list_node是否真正在parse_query行的点处定义。 – 2011-02-15 08:49:02