Re: Compilations failing - Mailing list pgsql-interfaces

From Andreas Gidlund
Subject Re: Compilations failing
Date
Msg-id BAY103-F36417701FB997960DB9AEFBA180@phx.gbl
Whole thread Raw
In response to Compilations failing  ("Andreas Gidlund" <vaxis@hotmail.com>)
Responses Re: Compilations failing  ("Andreas Gidlund" <vaxis@hotmail.com>)
List pgsql-interfaces
I am getting so frustrated here...

As compiling with the command prompt failed so hard, I went over to compile 
with msys and mingw and actually managed to compile postgres, but it failed 
on compiling a dynamic library of libpxx in the next step.
I have therefore left the ambitions to compile libpqxx for now. So I went on 
with making a project in visual studio 2005.net and the aim to use only the 
libpq dll I managed to compile in msys. That also failed...

So I have been searching all over the internet to find out how to use libpq 
in VS, but with no luck at all. I am missing a short and easy to follow 
guide. My test program only tries to create a connection object as follows:
PGconn *conn;conn = PQconnectdb("dbname = postgres");

I also have #include "libpq-fe.h" in the beginning. However, I get the 
following two messages when compiling:
error LNK2028: unresolved token (0A00000A) "extern "C" struct pg_conn * 
__clrcall PQconnectdb(char const *)" (?PQconnectdb@@$$J0YMPAUpg_conn@@PBD@Z) 
referenced in function "public: __clrcall 
IDBConnection::claPostgreSQL::claPostgreSQL(char *)" 
(??0claPostgreSQL@IDBConnection@@$$FQAM@PAD@Z)    claPostgreSQL.obj

error LNK2019: unresolved external symbol "extern "C" struct pg_conn * 
__clrcall PQconnectdb(char const *)" (?PQconnectdb@@$$J0YMPAUpg_conn@@PBD@Z) 
referenced in function "public: __clrcall 
IDBConnection::claPostgreSQL::claPostgreSQL(char *)" 
(??0claPostgreSQL@IDBConnection@@$$FQAM@PAD@Z)    claPostgreSQL.obj

Though, it is quite obvious it is at least because there is no reference to 
libpq.dll. I simply don't know how to refer to that file. I also read 
somewhere that I have to include libpqdll.lib, is that true?
Even more spoiling my attempts is that the only compiled file for libpq I 
get while compiling postgres through msys is the libpq.dll file. I found in 
the documentation of 7.4.13 that libpqdll.lib and libpq.lib also should be 
created, but they are not for me... The "make" call doesn't return any 
errors, just that postgres is ready to be installed. Has this been changed 
in v8 or should these files also be created there?

Can someone please help me? I'm soon starting to cry for real...


>From: "Jeroen T. Vermeulen" <jtv@xs4all.nl>
>To: "Andreas Gidlund" <vaxis@hotmail.com>
>CC: pgsql-interfaces@postgresql.org
>Subject: Re: [INTERFACES] Compilations failing
>Date: Wed, 27 Sep 2006 10:23:41 +0700 (ICT)
>
>On Wed, September 27, 2006 05:41, Andreas Gidlund wrote:
> > I have a problem when compiling libpqxx with the tools from VS.NET 2005
> > for use on Windows XP.
>
>But the actual errors you run into happen while compiling postgres itself,
>right?  You may want to come over the the libpqxx-general mailing list
>(see http://pqxx.org/ ) for help with libpqxx-specific problems.
>
>
> > However, after downloading libpqxx, as I wanted to compile and use it, I
> > ran
> > into problems. First, after having creating the common file in the win32
> > folder and when I was to change the paths inside, all three paths did 
>not
> > comply with my installation. First for the path to the source code, I
> > installed by using the msi distribution and hence did not have the 
>source
> > at hand.
>
>From what I've heard, the Windows installer doesn't install the header
>files for libpq, and those are needed for compiling libpqxx (or any other
>program that uses libpq).  That's why you need the postgres source
>archive.  The paths are a painful obstacle; there just don't seem to be
>any real standards for these things on Windows.
>
>I guess there really ought to be a separate "development package" of
>postgres for Windows like there is for other systems.  The problem seems
>to be that Windows lacks the necessary compiler standards--a development
>package would have to be compiler-specific.  :-(
>
>You should be able to get away with compiling just the Release version of
>libpqxx if that's what you want, using the Release version of libpq, and
>just "stealing" the libpq headers from the postgres source tree.  But
>chances are that you'll want to debug your software sometimes, if only
>during development, so it's better to have both Debug and Release versions
>of everything available.
>
>
>Jeroen
>
>

_________________________________________________________________
Börjar bilen krångla? Köp en ny http://motor.msn.se/



pgsql-interfaces by date:

Previous
From: erkan kolemen
Date:
Subject: Re: PGExec returns error without any comment
Next
From: "Andreas Gidlund"
Date:
Subject: Re: Compilations failing