Re: Difficulty getting started with Postgres C++ interface

From: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
To: David Wright <dwright(at)mergetel(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Difficulty getting started with Postgres C++ interface
Date: 2003-01-29 13:13:39
Message-ID: 20030129131339.GF46476@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Mon, Jan 27, 2003 at 05:42:11PM -0500, David Wright wrote:
>
> g++ -I/usr/include/pgsql myc.cpp -o myc

>
> /home/dwright/tmp/ccx7SvXE.o(.PgDatabase::gnu.linkonce.t.(char const *)+0x13): undefined reference to `PgConnection::PgConnection(char const *)'

If you're going to use a library, you'll have to link to it to get
a working program:

g++ -I/usr/include/pgsql myc.cpp -lpq++ -o myc

You may also have to link to the underlying C library, libpq:

g++ -I/usr/include/pgsql myc.cpp -lpq++ -lpq -o myc

And finally--shameless plug coming up--you may want to use libpqxx
instead of libpq++:

http://gborg.postgresql.org/project/libpqxx/

Jeroen

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message ljb 2003-01-30 02:09:00 Any interest in a Tcl-only libpgtcl project?
Previous Message Gerhard Häring 2003-01-28 09:00:06 Re: Python DB-API problem with PostgresSQL pgdb.