Re: [Beginner question]How to solve multiple definition of `yylval'?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wen Yi <chuxuec(at)outlook(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: [Beginner question]How to solve multiple definition of `yylval'?
Date: 2023-05-11 13:40:02
Message-ID: 1054458.1683812402@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Wen Yi <chuxuec(at)outlook(dot)com> writes:
> When I use the yacc & lex to compile,

> yacc -d 1-3.y
> lex 1-3.l
> gcc 1-3.tab.c lex.yy.c
> /usr/bin/ld: /tmp/ccYqqE5N.o:(.bss+0x28): multiple definition of `yylval'; /tmp/ccdJ12gy.o:(.bss+0x4): first defined here

Bison provides the declaration of yylval; don't add one yourself.

BTW, this isn't right:

#define YYSTPYE string

first because you misspelled YYSTYPE, and second because you
evidently want yylval to be double not a string.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Millas 2023-05-11 14:18:50 Re: Death postgres
Previous Message Wen Yi 2023-05-11 11:52:27 [Beginner question]How to solve multiple definition of `yylval'?