gpt4 book ai didi

编译稀疏0.4.1

转载 作者:行者123 更新时间:2023-11-30 14:22:48 24 4
gpt4 key购买 nike

我正在尝试编译一个依赖稀疏 0.4.1 的项目,但在尝试编译稀疏 0.4.1 时,我最终遇到以下编译器错误:

included from parse.c:25:
./parse.h:63:22: error: member of anonymous struct redeclares 'label_statement'
struct statement *label_statement;
^
./parse.h:40:22: note: previous declaration is here
struct statement *label_statement;

这让我感到困惑,因为它们是两个不同结构的不同成员,那么为什么它会提示呢?

代码如下所示:

struct statement {
enum statement_type type;
struct position pos;
union {
struct /* declaration */ {
struct symbol_list *declaration;
};
struct /* label_arg */ {
struct symbol *label;
struct statement *label_statement;
};
struct {
struct expression *expression;
struct expression *context;
};
struct /* return_statement */ {
struct expression *ret_value;
struct symbol *ret_target;
};
struct /* if_statement */ {
struct expression *if_conditional;
struct statement *if_true;
struct statement *if_false;
};
struct /* compound_struct */ {
struct statement_list *stmts;
struct symbol *ret;
struct symbol *inline_fn;
struct statement *args;
};
struct /* labeled_struct */ {
struct symbol *label_identifier;
struct statement *label_statement;
};
.......

最佳答案

在同一个 union 中声明语句 label_statement 两次,第一次在第 40 行,第二次在第 63 行

     struct statement *label_statement;

尝试编辑第二个的名称。

关于编译稀疏0.4.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13483974/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com