I have this code and I run it and get his error :
error: array type has incomplete element type 'struct entry'
and I try it to solve it and explore same error but got fail
#ifndef GLOBAL_H
#define GLOBAL_H
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <getopt.h>
//list of CONSTANTS
#define BSIZE 128
#define NONE -1
#define EOS '\0'
#define NUM 256
#define DIV 257
#define MOD 258
#define ID 259
#define DONE 260
//list of prototype function
void init();
int lexan();
int lookup(char s[]);
int insert(char s[], int tok);
void emit(int t,int tval);
void parse();
void expr();
void term();
void factor();
void match(int t);
void error(char* m);
//list of variables
FILE *input, *output, *err;
int tokenval;
int lineno;
int lookahead;
extern struct entry symtable[];
struct entry {
char *lexptr;
int token;
};
#endif
and I get error in this line :
extern struct entry symtable[];
this is code for ( global.h ) and other file not get an error
CodePudding user response:
Move the struct entry definition to be placed before it is first used.
struct entry {
char *lexptr;
int token;
};
extern struct entry symtable[];