读书人

lex and yacc编译异常gcc: compilat

发布时间: 2012-10-09 10:21:45 作者: rapoo

lex and yacc编译错误,gcc: compilation of header file requested
我用的编译命令:
yacc -d ctops.y
lex ctops.l
gcc y.tab.c lex.yy.c y.tab.h -o ctops
出现的错误:
gcc: compilation of header file requested

lex部分:
%{
#include "y.tab.h"
void stocke_commentaire();
char contenu[100];

int count;

%}
yacc部分:
%{
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include"structeurs.h"
FILE* yyin;
FILE* yyout;
extern noeudType* noeud_premiere;
extern char contenu[100];
extern int count;
noeudType* creer_noeud_reel (float value);

noeudType* creer_noeud_operateur (int numop,...);

noeudType* creer_noeud_identificateur(char* valuer);

noeudType* creer_noeud_definir (noeudType* noeud1,noeudType* noeud2);

int transformerCtoPostScript(noeudType* noeud,FILE* file);

noeudType* creer_noeud_commentaire(char* valeur);

void yyerror(char *s);

int yylex(void);

%}

[解决办法]
gcc y.tab.c lex.yy.c y.tab.h -o ctops
改为
gcc y.tab.c lex.yy.c -o ctops

读书人网 >UNIXLINUX

热点推荐