help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

So now there is a flex quesion :)...


From: Karlheinz Toni
Subject: So now there is a flex quesion :)...
Date: Wed, 30 Oct 2002 17:56:58 -0800

Hi there again

 

Finally I understood what bison and flex are for, at least I think so.
So I tried to make a very simple flex file and run it. As it is suggested on the homepage-tutorial I tried:

 

        int num_lines = 0, num_chars = 0;
 
%%
\n      ++num_lines; ++num_chars;
.       ++num_chars;
 
%%
main()
        {
        yylex();
        printf( "# of lines = %d, # of chars = %d\n",
                num_lines, num_chars );
        }

 

 

so I stored the whole source in a file called test.l

In the shell I type:

 

flex test.l

 

which produces a file called:

**********************

lex.yy.c

**********************

 

so now, when I try to compile this file via:

**********************

gcc lex.yy.c

**********************

 

I get the following error message:

**********************

Undefined                       first referenced

 symbol                             in file

yywrap                              /var/tmp/ccp8SqDe.o

ld: fatal: Symbol referencing errors. No output written to a.out

collect2: ld returned 1 exit status

**********************

 

I also tried

gcc lex.yy.clfl

 

for I have seen this at some different homepages. To include the lfl library.


What did I do wrong this time?

 

Sincerely

Karlheinz Toni

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]