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 1n7z8Y-0004Hc-DR for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Jan 2022 12:23:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7z8V-0007J0-Mw for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Jan 2022 12:23:23 +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 1n7z8V-0007Ir-D3 for pgsql-bugs@lists.postgresql.org; Thu, 13 Jan 2022 12:23:23 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n7z8O-0003oR-TG for pgsql-bugs@lists.postgresql.org; Thu, 13 Jan 2022 12:23:22 +0000 Received: by mail-il1-x12c.google.com with SMTP id x15so5451977ilc.5 for ; Thu, 13 Jan 2022 04:23:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TAGY7zUMEbKp06B4DerjFS0SVYGWnRSF/A9UBCZa0x4=; b=SGQwqkSRRRLIOgRhcltued9IYc1WGOn+SwFatyqW/bmLSDOAnaNqqWlesgRgBTlHEN /obORHG1Ajt4nF/wapa4K9PBkjdX6wzU6MiAlDetjOu1lwUMg1btr9lccRjuMyHu3fgX IDwCKz22B5A+tVlsQ+z7ZLhldD28SErgtAvCIjaNfPAXMDn8OZGxpBKOOAqKwTmt2Hys xaB4Dcfgv0ndNxFVOsSBPudB75Ip11i/phhcxQsVPUfXz4nb1k9Lf21dW7M6oaZ2RDj0 R8jGO6f/mFpWSG/zPijCSOwqzS5+qPJOiEs51SHVuCccWawd0GtLCKRlN0Mio3RW9e0b vlLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TAGY7zUMEbKp06B4DerjFS0SVYGWnRSF/A9UBCZa0x4=; b=pzqaj25nA7BWMbKnd60FKweIgFnIi4vyDaovDXj3DsNDDKd0ucIM3cem5SgX8xruN7 vHRp7UV34dkUhSfCQMPuMQRGt1GOgSpa5JQAPnWKlDOHnlBNea+8VizyHWVHme4vbqzD KT4PCpErggmeylPTNWM2UsIWEEvCtj1FjDNL3uCxCO2xguh7e4gnb7Btmcy2EPD2liz9 Ngl/Bq0yUf/0J/yHJ0j/kF7NqH956Og7aXq0j5nOAwi1DiHtIDF3+qH4exuKZLOWw0qF +fM6G4KOS3uDquVuUmgB5L6dWwuYiJh7VhA/IDl5lrOaarFlrchy/mrEq/XxCxTLWZDd soXA== X-Gm-Message-State: AOAM5321uY7wpiq+un9lhgRrEan5AOSJweR8GXSAZHvViB7BBEnPu0SZ vCgdW50osf76QkFG/BlkdIYQnPw3PrRSDA== X-Google-Smtp-Source: ABdhPJwtSZs2+Lz/F3d3Wy7A8VwivioyZ2B6EoYlJFNBeapDq/dDe7khPo5bLjEnOaTgDrI9JbqAKQ== X-Received: by 2002:a05:6e02:1aad:: with SMTP id l13mr2252383ilv.4.1642076595850; Thu, 13 Jan 2022 04:23:15 -0800 (PST) Received: from jrouhaud (1-171-185-43.dynamic-ip.hinet.net. [1.171.185.43]) by smtp.gmail.com with ESMTPSA id c18sm2443559iod.18.2022.01.13.04.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jan 2022 04:23:15 -0800 (PST) Date: Thu, 13 Jan 2022 20:23:10 +0800 From: Julien Rouhaud To: mario@emmenlauer.de, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h Message-ID: <20220113122310.ay24ciikcu257nkp@jrouhaud> References: <17365-c58cbf9d0c29586a@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17365-c58cbf9d0c29586a@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Jan 13, 2022 at 09:11:45AM +0000, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Then I build a wrapper library that uses `postgres.h` in my code. My code is > built using the LLVM Clang-Cl compiler frontend version 13.0.0 over > Microsoft Visual Studio 19.5. Generally, the Clang-Cl compiler frontend > works very well. But since updating PostgreSQL from 13.x to the 14.1 > release, I get an error: > ``` [...] > C:\BDA\bld\XTJyb_7r\0\DatabaseHandler\src\BDAPGResult.cc > In file included from > C:\BDA\bld\XTJyb_7r\0\DatabaseHandler\src\BDAPGResult.cc:31: > In file included from C:\data\ci-dst\Debug\include\server\postgres.h:46: > In file included from C:\data\ci-dst\Debug\include\server/c.h:1362: > In file included from C:\data\ci-dst\Debug\include\server/port.h:26: > C:\data\ci-dst\Debug\include\server/port/win32_port.h(256,8): error: > redefinition of 'stat' > struct stat /* This should match > struct __stat64 */ > ^ > C:\Program Files (x86)\Windows > Kits\10\include\10.0.19041.0\ucrt\sys/stat.h(87,12): note: previous > definition is here > struct stat > ^ > 1 error generated. > ``` Note that postgres.h is intended for backend-side code, and I'm assuming that your wrapper library is client code? Have you tried using postgres_fe.h instead?