c - 头文件错误 : incomplete type is not allowed

标签 c struct header-files keil

这是我的头文件:

typedef int* Arg;   
typedef int* Args[];
typedef int** ArgsList[];

typedef int (*ProcessStart)(Args);

typedef struct PCBEntry{

    ProcessStart proc;
    Args args;
    int pid;
    int curr_proc;
    int sched_info;
    int pc;

} PCBEntry;

我在结构中的 Args args 行收到错误,我不知道为什么。

最佳答案

因为您将 Args 定义为 int *[],所以成员 args 被有效地声明为

int *args[];

这是一个灵活的数组成员,它们只允许出现在结构的末尾。

如果您想暗示 Args 是一个指针(与 char **argv 相同),请将其声明为指针:

typedef int **Args;

关于c - 头文件错误 : incomplete type is not allowed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15975453/

相关文章:

C 语言 - 结构声明和内部静态成员

go - 在 Golang 中将接口(interface){}转换为结构

c++ - 从头文件调用CPP函数

c++ - 多小类分布

c++ - 当结构定义在头文件中时,如何在 main() 中创建结构数组?

c - 快板蛇游戏

c - 如何拥有一个返回整数指针的函数数组

c++ - 运行时库只是一些动态链接的库文件吗?

c - 如何在 C 中获取无符号 8 位类型的最高有效位

c - "structure with flexible array member shall not be a member of a structure"的基本原理是什么?