Re: error C2011 in Visual Studio 2012 - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: error C2011 in Visual Studio 2012
Date
Msg-id 51071075.5070104@2ndQuadrant.com
Whole thread Raw
In response to error C2011 in Visual Studio 2012  ("Anderson C. Carniel" <accarniel@gmail.com>)
List pgsql-hackers
On 01/27/2013 01:14 AM, Anderson C. Carniel wrote:
Hi,

I'm trying to build a. dll file to extend the postgres server with C functions. I'm using visual studio 2012 to build the dll, and PostgreSQL 9.2. I imported all directories postgres "\include\server*" But I'm having the errors:

error C2011: 'timezone': 'struct' type redefinition

error C2011: 'itimerval': 'struct' type redefinition

In the file *pg_confi_os.h* at line 205 and 214


First, you'll want to build with Visual Studio 2010 or older. The Express edition works fine.

Second, it's very unlikely that you can just compile the extension .c file stand-alone. You'll need to set a bunch of preprocesor definitions, some of which are somewhat configuration/environment specific.

The best way to compile extensions at the moment may be to get the PostgreSQL source tree, add your extension as a folder inside the contrib/ directory with a Makefile, then use the tooling in src/tools/msvc to compile the source tree including the extension.

I would really like to see this improve, with a working PGXS alternative for Windows MSVC builds. I'm not presently aware of anything, but I haven't investigated building extensions out of tree under Windows/MSVC in detail yet.

--  Craig Ringer                   http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Event Triggers: adding information
Next
From: Tom Lane
Date:
Subject: Hm, table constraints aren't so unique as all that