繁体   English   中英

typedef struct和extern声明的未知类型名称错误 - C语言

[英]unknown type name error with typedef struct and extern declaration - C language

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

在文件application.h中,我创建了一个typedef结构:

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的typedef结构。我在temperature.h中包含application.h。

对于我的* .h文件,我总是用以下内容封装:

#ifndef xxxx
#define xxxx
#endif

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

Description Resource    Path    Location    Type
unknown type name 'ButterwothSecondOrderFilterParameter_str'

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

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

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

我试图删除temperature.h中的extern声明,它可以工作。

所以温度类型未知,但温度不是....我不明白。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM