Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: mario(at)emmenlauer(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h
Date: 2022-01-13 12:23:10
Message-ID: 20220113122310.ay24ciikcu257nkp@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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?

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2022-01-13 15:12:13 Re: BUG #17362: Error "could not find block containing chunk" when using index with icu collation on CentOS 7
Previous Message PG Bug reporting form 2022-01-13 09:11:45 BUG #17365: Error: redefinition of 'stat' in win32_port.h when including postgres.h