Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
yacc-字段的类型不完整_C_Bison_Yacc - Fatal编程技术网

yacc-字段的类型不完整

yacc-字段的类型不完整,c,bison,yacc,C,Bison,Yacc,yacc似乎不喜欢我的令牌属于我定义的类型 在%{…%}块中语法(.y)文件的顶部,我包含一个头文件,它定义了以下结构: typedef struct _spim_register { spim_register_type type; /* This is a simple enumeration, already defined */ int number; } spim_register; 在我的规则列表之前,我有: %token AREG ..

yacc似乎不喜欢我的令牌属于我定义的类型

%{…%}
块中语法(
.y
)文件的顶部,我包含一个头文件,它定义了以下结构:

typedef struct _spim_register {
    spim_register_type type; /* This is a simple enumeration, already defined */
    int number;              
} spim_register;
在我的规则列表之前,我有:

%token AREG
...
%union {
struct _spim_register reg;
}
...
%type <reg> register AREG
似乎
%union{…}
有一些特殊之处,因为我能够在规则的操作中使用头文件中的数据结构。

如果我的
#includes
的顺序正确,这将有所帮助


答案是,正如用户786653所暗示的那样。我需要在
.l

文件中包含定义自定义结构的头文件,然后在
.l

文件中包含
.tab.h
文件。因为我的*.l文件是这样的:

包括“y.tab.h” 包括“FP.h” 然后,我就这样重写:

包括“FP.h” 包括“y.tab.h”
它起作用了。多谢各位@ArIck

在xcode中工作时,我发现我需要删除项目的派生数据,以便重新排序真正发生。由于某种原因,xcode实际上并没有包含新文件。对我来说也是如此。谢谢
unknown type name ‘spim_register’