您好,我收到了一些编译器警告,但我无法找出问题所在。我已经解决了其他小问题,但这只是困扰我。 谢谢你的帮助
标记
agent.h:10: 错误:‘FILE’之前的预期说明符限定符列表
#ifndef AGENT_H
#define AGENT_H
struct AgentInfo {
int cordRow;
int cordCol;
char indicator;
char* fileName;
char direction;
pid_t agentPid;
FILE* agentIn;//Error shows here
FILE* agentOut;;
struct AgentInfo *next;
};
struct AgentInfo *createLinkedList(int r,int c, char i, char *fn, char dir);
struct AgentInfo *addToLinkedList(int r,int c, char i, char *fn, char dir);
struct AgentInfo *findAgent(char* fn, struct AgentInfo **prevAgent);
extern struct AgentInfo *head = NULL;
extern struct AgentInfo *current = NULL;
#endif
谢谢你的帮助
最佳答案
那是因为FILE
不是原始类型;它包含在 stdio.h
中 header 。所以你需要使用 #include <stdio.h>
来包含它在你的文件中。
关于c - 错误 : expected specifier qualifier list before FILE in header struct,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19031244/