为什么我会遇到此编译器错误

Why do I get this compiler error?

本文关键字:编译器 错误 遇到 为什么      更新时间:2023-10-16

我想了解此错误:语法错误,然后在以下代码上'bool'之前:

typedef struct hdate{
    date_arc_u  date;
    unsigned short  time;
    bool test;
}PACKED_ST horodate_a

当我将布尔更改为另一种类型时,没有错误。我已经在代码的其他部分中使用了bool而没有错误。

我在这里不明白此错误....

这可能是因为您正在编写C代码,并且bool类型不存在C中。用c。

可能您的C编译器可能不知道Bool类型。

您可以尝试:

1-首先在#include <stdbool.h>

中包括此

2-首先声明typedef enum bool { false, true };