Re: BUG #15167: error C2365: 'errcode' : redefi nition; previous definition

From: Hao Lee <mixtrue(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15167: error C2365: 'errcode' : redefi nition; previous definition
Date: 2018-04-23 08:28:16
Message-ID: CAGoxFiFtzunYzvSJ24iBvCwMpXPOMsxGC02SVQfQuM4_e_xb=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

yes, the code you mentioned, on my env. as following:

/*
* We need to prevent <crtdefs.h> from defining a symbol conflicting with
* our errcode() function. Since it's likely to get included by standard
* system headers, pre-emptively include it now.
*/
#if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H)
#define errcode __msvc_errcode
#include <crtdefs.h>
#undef errcode
#endif
----------------------------------------------------------
the ms version info as following:
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: Professional

Microsoft Visual C++ 2008 91605-270-4948377-60248
Microsoft Visual C++ 2008

-----------------------------------------------------------------------
the value of _MSC_VER is 1500.

On Mon, Apr 23, 2018 at 3:48 PM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:

> On 23/04/18 02:49, Hao Lee wrote:
>
>> The more info:
>> 1>d:\postgres\src\include\utils/elog.h(131) : error C2365: 'errcode' :
>> redefinition; previous definition was 'typedef'
>> 1> C:\Program Files (x86)\Microsoft Visual Studio
>> 9.0\VC\include\crtdefs.h(560) : see declaration of 'errcode'
>>
>
> In src/include/port/win32.h, we have this:
>
> /*
>> * We need to prevent <crtdefs.h> from defining a symbol conflicting with
>> * our errcode() function. Since it's likely to get included by standard
>> * system headers, pre-emptively include it now.
>> */
>> #if _MSC_VER >= 1400 || defined(HAVE_CRTDEFS_H)
>> #define errcode __msvc_errcode
>> #include <crtdefs.h>
>> #undef errcode
>> #endif
>>
>
> For some reason, that doesn't seem to be working as intended, on your
> system. Do you see the above in src/include/pg_config_os.h ?
>
> What version of Visual Studio or Platform SDK are you using? What is the
> value of _MSC_VER on your system?
>
> - Heikki
>

--
A Database Kernel Engineer. @
http://www.leehao.org.
MyBook: Inside into PostgreSQL Query Engine. @amazon China
<https://www.amazon.cn/%E5%9B%BE%E4%B9%A6/dp/B01KG96FVC/ref=sr_1_1?ie=UTF8&qid=1496719538&sr=8-1&keywords=postgresql%E6%9F%A5%E8%AF%A2%E5%BC%95%E6%93%8E%E6%BA%90%E7%A0%81%E6%8A%80%E6%9C%AF%E6%8E%A2%E6%9E%90>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Cramer 2018-04-23 22:25:07 Re: BUG #15152: Java heap size
Previous Message Heikki Linnakangas 2018-04-23 07:48:38 Re: BUG #15167: error C2365: 'errcode' : redefi nition; previous definition