lex compilation question

lex compilation question

Post by Fran?oi » Sun, 20 Jan 2002 05:03:03



When I compile a C file created with lex, using

% cc -lfl -o exo2 lex.yy.c
/tmp/ccmoVbyp.o: In function `yylex':
/tmp/ccmoVbyp.o(.text+0x31c): undefined reference to `yywrap'
/tmp/ccmoVbyp.o: In function `input':
/tmp/ccmoVbyp.o(.text+0xae2): undefined reference to `yywrap'
collect2: ld returned 1 exit status

I get an error message, but if I change the order of the command,
everything work ....

% cc lex.yy.c -o exo2 -ll              #work very well

Can somebody explain me why ?

 
 
 

lex compilation question

Post by Jens.Toerr.. » Sun, 20 Jan 2002 07:08:13



> When I compile a C file created with lex, using
> % cc -lfl -o exo2 lex.yy.c
> /tmp/ccmoVbyp.o: In function `yylex':
> /tmp/ccmoVbyp.o(.text+0x31c): undefined reference to `yywrap'
> /tmp/ccmoVbyp.o: In function `input':
> /tmp/ccmoVbyp.o(.text+0xae2): undefined reference to `yywrap'
> collect2: ld returned 1 exit status
> I get an error message, but if I change the order of the command,
> everything work ....
> % cc lex.yy.c -o exo2 -ll              #work very well

As far as I remember having read you need -ll for lex while -lfl for
flex. So, if you really use lex use -ll, if you use flex take -fl. But
take care, on some systems lex is just a symbolic link to flex.

                                    Regards, Jens
--
      _  _____  _____

  _  | |  | |    | |          AG Moebius, Institut fuer Molekuelphysik
 | |_| |  | |    | |          Fachbereich Physik, Freie Universitaet Berlin
  \___/ens|_|homs|_|oerring   Tel: ++49 (0)30 838 - 53394 / FAX: - 56046

 
 
 

lex compilation question

Post by Artie Gol » Sun, 20 Jan 2002 08:08:54



> When I compile a C file created with lex, using

> % cc -lfl -o exo2 lex.yy.c
> /tmp/ccmoVbyp.o: In function `yylex':
> /tmp/ccmoVbyp.o(.text+0x31c): undefined reference to `yywrap'
> /tmp/ccmoVbyp.o: In function `input':
> /tmp/ccmoVbyp.o(.text+0xae2): undefined reference to `yywrap'
> collect2: ld returned 1 exit status

> I get an error message, but if I change the order of the command,
> everything work ....

> % cc lex.yy.c -o exo2 -ll              #work very well

> Can somebody explain me why ?

In general, library directives should go _after_ the objects that will
make use of them (in the case of dynamic linking, usually doesn't
matter; in the case of static linking -- as I suspect you're doing here
-- it always does).

HTH,
--ag
--
Artie Gold  --  Austin, TX

"May you keep turning the pages. And may the book never end."

 
 
 

1. Lex maximum - Error when compiling with "lex"

I am trying to compile a long lex file, and am getting different errors.
I am using an SGI, with IRIX 5.3 and lots of memory.  When I reach the
lex limit, I first get:

"lex_test.l":line 423: Error: Too many positions for one state - acompute
3756/8000 nodes(%e), 5716/20000 positions(%p), 2/4000 (%n), 0 transitions,
8/20000 packed char classes(%k), 0/16000 packed transitions(%a), 0/24000 output slots(%o)

I increased the parameters to:

%e 10000
%p 30000
%n 5000
%k 30000
%a 20000
%o 30000

The results when compiling with the previous options are:

"lex_test.l":line 430: Error: Too many positions for one state - acompute
3756/10000 nodes(%e), 5716/30000 positions(%p), 2/5000 (%n), 0 transitions,
8/30000 packed char classes(%k), 0/20000 packed transitions(%a), 0/30000 output slots(%o)

Has anyone had this problem, and solved it?

Ruben Yanas

2. Thank you/what now? {Was: What the HELL...}

3. lex question

4. Help: NFS problem

5. lex question: how to set search specification at run-time

6. ADSL

7. newbie lex question: parsing Postscript

8. Big Blue, Linux, & ObjectRexx

9. Simple lex v. yacc question

10. lex & nawk : Questions

11. LEX question

12. newbie question - lex

13. awk,sed, or lex question