treedraw: compilation error

Rupert Wood me@rupey.net
Tue May 21 01:48:00 GMT 2002


Gerhard Reuteler wrote:

> gcc -g -w -c lex.yy.c
> lex.yy.c:20: initializer element is not constant
> lex.yy.c:20: initializer element is not constant
> make: *** [lex.yy.o] Error 1
:
> FILE *yyin =stdin, *yyout =stdout;     <---- this is line 20

This one gets a mention in the GCC commonly reported bugs list:

    http://gcc.gnu.org/bugs.html#c

glibc doesn't implement stdin/out as constants. From the bugs page,

    This construct commonly occurs in code generated by old versions
    of lex or yacc. We suggest you try regenerating the parser with a
    current version of flex or bison, respectively. In your own code,
    the appropriate fix is to move the initialization to the beginning
    of main.

flex, a replacement for lex, may already be part of your OS distribution
or you can find the source on any GNU mirror, e.g.
http://sunsite.org.uk/gnu/non-gnu/flex/

Good luck,
Rup.



More information about the Gcc-help mailing list