0

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

0

1 Answer 1

1

Move the struct entry definition to be placed before it is first used.

struct entry {
    char *lexptr;
    int token;
};

extern struct entry symtable[];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.