Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1px6We-0002xj-76 for pgsql-general@arkaria.postgresql.org; Thu, 11 May 2023 13:40:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1px6Wd-0003TN-1J for pgsql-general@arkaria.postgresql.org; Thu, 11 May 2023 13:40:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1px6Wc-0003TE-Nf for pgsql-general@lists.postgresql.org; Thu, 11 May 2023 13:40:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1px6WZ-001kkF-LB for pgsql-general@lists.postgresql.org; Thu, 11 May 2023 13:40:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 34BDe2tZ1054459; Thu, 11 May 2023 09:40:02 -0400 From: Tom Lane To: Wen Yi cc: PostgreSQL General Subject: Re: [Beginner question]How to solve multiple definition of `yylval'? In-reply-to: References: Comments: In-reply-to Wen Yi message dated "Thu, 11 May 2023 11:52:27 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1054457.1683812402.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 11 May 2023 09:40:02 -0400 Message-ID: <1054458.1683812402@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Wen Yi 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