【发布时间】:2021-07-21 18:13:30
【问题描述】:
我在编译我的项目时遇到了一个问题。我正在尝试将一个结构放入队列中,该结构已在这样的头文件中贴花:
约会函数头文件(“signupFunctions.h”是我的“患者”声明):
#ifndef appointmentFunctions_H__
#define appointmentFunctions_H__
#include "queueFunctions.h"
#include "signupFunctions.h"
typedef struct{
int cough;
int rDistress;
int fatigue;
int fever;
}symptoms;
typedef symptoms *Symptoms;
typedef struct {
Patient patient;
Symptoms symptoms;
int day;
int mon;
int year;
int flag;
}appointment;
typedef appointment *Appointment;
int getSymptomsValue(Appointment A);
void setSymptoms(Appointment A);
void requestAppointment(Patient P, qNodePtr *head, qNodePtr *tail);
#endif
队列函数头文件:
#ifndef queueFunctions_H__
#define queueFunctions_H__
#include "appointmentFunctions.h"
typedef struct qNode{
Appointment A;
struct qNode *next;
}QueueNode;
typedef QueueNode *qNodePtr;
void printQueue(qNodePtr currentPtr);
int isEmpty(qNodePtr head);
void dequeue(qNodePtr *head, qNodePtr *tail);
void enqueue(qNodePtr *head, qNodePtr *tail, Appointment App);
#endif
编译后我得到:
In file included from appointmentFunctions.h:4:0,
from menuFunctions.h:5,
from main.c:4:
queueFunctions.h:7:2: error: unknown type name 'Appointment'
Appointment A;
^~~~~~~~~~~
queueFunctions.h:16:46: error: unknown type name 'Appointment'
void enqueue(qNodePtr *head, qNodePtr *tail, Appointment App);
^~~~~~~~~~~
In file included from appointmentFunctions.h:4:0,
from menuFunctions.h:5,
from signupFunctions.c:5:
queueFunctions.h:7:2: error: unknown type name 'Appointment'
Appointment A;
^~~~~~~~~~~
queueFunctions.h:16:46: error: unknown type name 'Appointment'
void enqueue(qNodePtr *head, qNodePtr *tail, Appointment App);
^~~~~~~~~~~
..等等。有什么问题?提前致谢。
【问题讨论】:
标签: c struct header include declaration