public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* treedraw: compilation error
@ 2002-05-20 11:14 Gerhard Reuteler
  0 siblings, 0 replies; 3+ messages in thread
From: Gerhard Reuteler @ 2002-05-20 11:14 UTC (permalink / raw)
  To: gcc-help

Hi,
trying to compile an old source "treedraw", perhaps written for windows in 
198?,  I get the error message
pismo:/usr/src/treedraw# make
.................................
.................................
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

the file lex.yy.c looks like

# include "stdio.h"
# define U(x) ((x)&0377)
# define NLSTATE yyprevious=YYNEWLINE
# define BEGIN yybgin = yysvec + 1 +
# define INITIAL 0
# define YYLERR yysvec
# define YYSTATE (yyestate-yysvec-1)
# define YYOPTIM 1
# define YYLMAX 200
# define output(c) putc(c,yyout)
# define input() 
(((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
# define unput(c) {yytchar= 
(c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
# define yymore() (yymorfg=1)
# define ECHO fprintf(yyout, "%s",yytext)
# define REJECT { nstr = yyreject(); goto yyfussy;}
int yyleng; extern char yytext[];
int yymorfg;
extern char *yysptr, yysbuf[];
int yytchar;
FILE *yyin =stdin, *yyout =stdout;     <---- this is line 20

As I don't know anything about C, I don't understand the problem. Any help is 
appreciated.

so long
Gerhard
-- 
Gerhard Reuteler , Reitweg 26d , A-6830 Rankweil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: treedraw: compilation error
       [not found] <616BE6A276E3714788D2AC35C40CD18D640288@whale.softwire.co.uk>
@ 2002-05-21  1:48 ` Rupert Wood
  0 siblings, 0 replies; 3+ messages in thread
From: Rupert Wood @ 2002-05-21  1:48 UTC (permalink / raw)
  To: 'Gerhard Reuteler'; +Cc: gcc-help

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* treedraw: compilation error
@ 2002-05-20 11:14 Gerhard Reuteler
  0 siblings, 0 replies; 3+ messages in thread
From: Gerhard Reuteler @ 2002-05-20 11:14 UTC (permalink / raw)
  To: gcc-help

Hi,
trying to compile an old source "treedraw", perhaps written for windows in 
198?,  I get the error message
pismo:/usr/src/treedraw# make
.................................
.................................
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

the file lex.yy.c looks like

# include "stdio.h"
# define U(x) ((x)&0377)
# define NLSTATE yyprevious=YYNEWLINE
# define BEGIN yybgin = yysvec + 1 +
# define INITIAL 0
# define YYLERR yysvec
# define YYSTATE (yyestate-yysvec-1)
# define YYOPTIM 1
# define YYLMAX 200
# define output(c) putc(c,yyout)
# define input() 
(((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
# define unput(c) {yytchar= 
(c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
# define yymore() (yymorfg=1)
# define ECHO fprintf(yyout, "%s",yytext)
# define REJECT { nstr = yyreject(); goto yyfussy;}
int yyleng; extern char yytext[];
int yymorfg;
extern char *yysptr, yysbuf[];
int yytchar;
FILE *yyin =stdin, *yyout =stdout;     <---- this is line 20

As I don't know anything about C, I don't understand the problem. Any help is 
appreciated.

so long
Gerhard
-- 
Gerhard Reuteler , Reitweg 26d , A-6830 Rankweil

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-21  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-20 11:14 treedraw: compilation error Gerhard Reuteler
2002-05-20 11:14 Gerhard Reuteler
     [not found] <616BE6A276E3714788D2AC35C40CD18D640288@whale.softwire.co.uk>
2002-05-21  1:48 ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).