Error with struct declare ( error: array type has incomplete element type 'struct entry' )
Error with struct declare ( error: array type has incomplete element type 'struct entry' )
我有这个代码,我运行它并得到他的错误:
错误:数组类型的元素类型不完整'struct entry'
我尝试用它来解决它并探索同样的错误但失败了
#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 '[=10=]'
#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
我在这一行中遇到错误:
extern struct entry symtable[];
这是 ( global.h ) 的代码,其他文件不会出错
将结构条目定义移至首次使用前的位置。
struct entry {
char *lexptr;
int token;
};
extern struct entry symtable[];
我有这个代码,我运行它并得到他的错误:
错误:数组类型的元素类型不完整'struct entry'
我尝试用它来解决它并探索同样的错误但失败了
#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 '[=10=]'
#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
我在这一行中遇到错误:
extern struct entry symtable[];
这是 ( global.h ) 的代码,其他文件不会出错
将结构条目定义移至首次使用前的位置。
struct entry {
char *lexptr;
int token;
};
extern struct entry symtable[];