ho un "linguaggio" semplice che sto usando Flex (lessicale Analyzer), è come questo:undefined reference to yywrap
/* Just like UNIX wc */
%{
int chars = 0;
int words = 0;
int lines = 0;
%}
%%
[a-zA-Z]+ { words++; chars += strlen(yytext); }
\n { chars++; lines++; }
. { chars++; }
%%
int main()
{
yylex();
printf("%8d%8d%8d\n", lines, words, chars);
}
L'ho eseguito un flex count.l
, tutto va bene, senza errori o avvisi, poi quando provo a fare un cc lex.yy.c
ho ottenuto questo errore:
ubuntu @ eeepc: ~/Desktop $ cc lex.yy.c
/tmp/ccwwkhvq.o: In funzioneyylex': lex.yy.c:(.text+0x402): undefined reference to
yywrap'
/tmp/ccwwkhvq.o: In funzione diinput': lex.yy.c:(.text+0xe25): undefined reference to
yywrap'
collect2: ld ha restituito lo stato 1 uscita
Cosa c'è di sbagliato?
Grazie mille! –
Molto apprezzato questo – JonnyRo
Semplice, breve, e al punto. Molto utile. –