错误:标头结构中FILE之前的预期说明符限定符列表(Error : expected specifier qualifier list before FILE in header struct)

编程入门 行业动态 更新时间:2024-10-18 08:27:47
错误:标头结构中FILE之前的预期说明符限定符列表(Error : expected specifier qualifier list before FILE in header 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

感谢您的帮助

Hi im getting a couple of compiler warnings in and i cant figure out the problem. I have solved other little issues but this ones just bugging me. Thank you for your help

Mark

agent.h:10: error: expected specifier-qualifier-list before ‘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

Thank you for your help

最满意答案

那是因为FILE不是原始类型; 它包含在stdio.h头文件中。 因此,您需要在文件中使用#include <stdio.h>包含它。

That's because FILE is not a primitive type; it is contained in the stdio.h header. So you need to include it using #include <stdio.h> within your file.

更多推荐

本文发布于:2023-08-07 14:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464556.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:说明符   错误   结构   列表   FILE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!