未知类型名称错误与类型定义结构和外部声明- C语言



我想了解我的C语言编译器的错误。

在文件application.h中,我创建了一个类型定义结构:
typedef struct
{
    FLOAT64 CoefficientA1_F64;
    FLOAT64 CoefficientA2_F64;
    FLOAT64 CoefficientB0_F64;
    FLOAT64 CoefficientB1_F64;
    FLOAT64 CoefficientB2_F64;
    FLOAT32 OldOldRawValue_F32;
    FLOAT32 OldRawValue_F32;
    FLOAT32 RawValue_F32;
    FLOAT32 OldOldFilteredValue_F32;
    FLOAT32 OldFilteredValue_F32;
    FLOAT32 FilteredValue_F32;
}ButterwothSecondOrderFilterParameter_str;

然后在另一个文件temperature.c:

中创建变量
ButterwothSecondOrderFilterParameter_str TMP_TemperatureLowPassFilterParameter_STR;

然后我在temperature.h中将这个新变量声明为extern,以便在另一个文件中使用它:

extern ButterwothSecondOrderFilterParameter_str TMP_TemperatureLowPassFilterParameter_STR;

对于*.c文件,我只包含相关的*.h文件,如果我需要从另一个*.h文件中包含全局变量,我将它包含在*.h文件

例如,temperature.c只包含temperature.h,为了访问application.h的类型定义结构,我在temperature.h中包含了application.h。

对于我的*.h文件,我总是用:

封装
#ifndef xxxx
#define xxxx
#endif

这是最后一个产生错误的声明:

Description Resource    Path    Location    Type
unknown type name 'ButterwothSecondOrderFilterParameter_str'

我不知道我的错误在哪里....div ?

我应该把application.h包含在temperature.h中。那么temperature.h是temperature.c中包含的唯一文件。我补充说,temperature.h也包含在application.h中,通常没有后果。

我试图直接在temperature.c中添加application.h,但我有同样的错误。

我试图在temperature.h中删除外部声明,它工作了。

对于temperature.h,类型为unknown,而对于temperature.c,类型为unknown ....我不明白。

最新更新