in .h:
typedef struct token_t TOKEN;
in .c:
#include "token.h"
struct token_t
{
char* start;
int length;
int type;
};
in main.c:
#include "token.h"
int main ()
{
TOKEN* tokens; // here: ok
TOKEN token; // here: Error: incomplete type is not allowed
// ...
}
The error I get in that last line:
Error: incomplete type is not allowed
What's wrong?
You need to move the definition of the struct
into the header file:
/* token.h */
struct token_t
{
char* start;
int length;
int type;
};