Search code examples
cstructheader-fileskeil

Header file error: incomplete type is not allowed


This is my header file:

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;

I get the error on the Args argsline in the struct and I have no idea why.


Solution

  • Because you defined Args as int *[], the member args is effectively declared as

    int *args[];
    

    This is a flexible array member, and they are only allowed at the end of a structure.

    If you meant to imply that Args was a pointer (in the same vein as char **argv), declare it as a pointer:

    typedef int **Args;