[英]Unknown type name in C?
Ok, so I am programming some code in C the program is mainly using pointers I am almost done but have this issue with I keep getting unknown type name on parts of the code.好的,所以我正在用 C 编写一些代码,该程序主要使用指针,我快完成了,但是有这个问题,我在代码的某些部分不断得到未知的类型名称。 For example in the code below I keep getting ''Unknown type name Pulse'' Essentially it uses objects in C using the tinytimber kernel but Pulse is included in the code.
例如,在下面的代码中,我不断收到“未知类型名称 Pulse”。本质上它使用 C 语言中的对象使用 tinytimber 内核,但代码中包含 Pulse。
#include "Pulse.h"
typedef struct {
Object super;
Pulse *PulserOne;
Pulse *PulserTwo;
Pulse *Pulsing;
} GUI;
This is another class of the code where pulse is created.这是创建脉冲的另一类代码。
typedef struct {
Object super;
int pin;
int frequency;
int stored;
int oldFrequency;
} Pulse;
# define initPulse(pin, frequency,stored,oldFrequency{initObject(),number, frequency, stored, oldFrequency
This is the main class where the objects are declared.这是声明对象的主类。
Pulse PulserOne = initPulse(4, 0, 0, 0, &p);
Pulse PulserTwo = initPulse(6, 0, 0, 0, &p);
GUI gui = initGUI(&PulserOne, &PulserTwo, &PulserOne);
I keep getting ''Unknown type name Pulse''
我不断收到“未知类型名称脉冲”
Move the definition of Pulse
before its use.在使用之前移动
Pulse
的定义。 @UnholySheep @UnholySheep
#include "Pulse.h"
// move here.
typedef struct {
Object super;
int pin;
int frequency;
int stored;
int oldFrequency;
} Pulse; // Pulse defined here
typedef struct {
Object super;
Pulse *PulserOne; // Pulse used here
Pulse *PulserTwo;
Pulse *Pulsing;
} GUI;
Alternative: Declare the existence of Pulse
替代方案:声明
Pulse
的存在
// v--v--------- Use some name
typedef struct Fred Pulse; // Pulse declared here
typedef struct {
Object super;
Pulse *PulserOne; // Pulse used here
Pulse *PulserTwo;
Pulse *Pulsing;
} GUId;
typedef struct Fred {
Object super;
int pin;
int frequency;
int stored;
int oldFrequency;
} Pulse; // Pulse defined here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.