From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wen Yi <chuxuec@outlook.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: [Beginner question]How to solve multiple definition of `yylval'?
Date: Thu, 11 May 2023 09:40:02 -0400
Message-ID: <1054458.1683812402@sss.pgh.pa.us> (raw)
In-Reply-To: <TYAP286MB063665A17431CD4D243315D7A9749@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM>
References: <TYAP286MB063665A17431CD4D243315D7A9749@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM>
Wen Yi <chuxuec@outlook.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, chuxuec@outlook.com
Subject: Re: [Beginner question]How to solve multiple definition of `yylval'?
In-Reply-To: <1054458.1683812402@sss.pgh.pa.us>
References: <TYAP286MB063665A17431CD4D243315D7A9749@TYAP286MB0636.JPNP286.PROD.OUTLOOK.COM> <1054458.1683812402@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox