【问题标题】:C error: unknown type name 'FILE', in functionC 错误:未知类型名称“文件”,在函数中
【发布时间】:2018-10-24 08:25:01
【问题描述】:

在我的头文件中,我放置了我添加的所有函数声明

void record(FILE *fptr);`

但是,我不断收到错误

未知类型名称'FILE',在函数中`

有谁知道我做错了什么?

【问题讨论】:

  • 好的,你在哪里告诉计算机FILE是什么?
  • 你必须在头文件中包含stdio.h
  • 你必须包含 studio.h
  • 在你的头文件顶部添加包含stdio.h,就在保护部分之后。即#ifndef MY_H_INC #define MY_H_INC #include <stdio.h> ... void record(FILE* fptr); .... #endif /*MY_H_INC*/

标签: c function pointers error-handling


【解决方案1】:

FILE 不是 C 中的原始类型或内置类型。它是stdio.h 中特别定义的类型,因此您必须在上面的代码中使用FILE* 指针。

【讨论】:

    猜你喜欢
    • 2021-07-21
    • 1970-01-01
    • 2012-02-20
    • 2016-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多