c - 错误 : expected specifier qualifier list before FILE in header struct

标签 c struct

您好,我收到了一些编译器警告,但我无法找出问题所在。我已经解决了其他小问题,但这只是困扰我。 谢谢你的帮助

标记

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/

相关文章:

c - C 中的指定初始化数组

C++ StackOverflowException 初始化超过 63992 的结构

c# - 使用更多结构?

c - 指针指向的值没有更新

C - "Connection refused"在一个已经打开的套接字上

c - 使用 CC 编译器 (Solaris) 时链接 unistd.h

c - 编写一个使用指针和位运算符来更改内存中一位的 C 函数?

c - 搜索和编辑功能没有复制粘贴?

c++ - 使用模板删除/添加结构成员

c# - 将 C# 结构暴露给 VB6 应用程序的 COM 中断