Package: flex
Version: 2.6.0

I downloaded, compiled and installed the latest flex, from source. No
problems showed.

To start using it, I have the file fb1-1.l:

=======
/* wc */
%{
int chars = 0;
int words = 0;
int lines = 0;
%}
%%
[a-zA-Z]+       { words++; chars += strlen(yytext); }
\n              { chars++; lines++; }
.               { chars++; }
%%
main()
{
    yylex();
    printf("lines   words   chars\n");
    printf("%8d %8d %8d\n", lines, words, chars);
}

=======

I compile it, but it gives a few warnings in the generated lex.yy.c file.
The output from the terminal, including the commands I have used, is:

==========

$ flex fb1-1.l

$ gcc -Wall lex.yy.c

fb1-1.l:xx: warning: control reaches end of non-void function
/tmp/ccydizSI.o: In function `yylex':
/.../lex.yy.c:846: undefined reference to `yywrap'
/tmp/ccydizSI.o: In function `input':
/.../lex.yy.c:1186: undefined reference to `yywrap'
collect2: ld returned 1 exit status

==========

Shouldn't this work?

Reply via email to