Skip site navigation (1) Skip section navigation (2)

Re: c++ compile/link problem

From: Randy Jonasz <rjonasz(at)click2net(dot)com>
To: Shane Hansen <sl1fm(at)cc(dot)usu(dot)edu>
Cc: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: c++ compile/link problem
Date: 2001-03-30 17:08:32
Message-ID: Pine.BSF.4.30.0103301205100.23741-100000@nietzsche.jaded.net (view raw or flat)
Thread:
Lists: pgsql-interfaces
On Thu, 29 Mar 2001, Shane Hansen wrote:

> I am struggling trying to get a connection to my postgres database from a c++ program.  I have read the documention and looked at many examples, but when I try to compile the code I get the same type errors every time.  They look like:
>
> /tmp/cc38u8Jz.o: In function `main':
> /tmp/cc38u8Jz.o(.text+0x3b): undefined reference to `PgConnection::PgConnection(
> char const *)'
> /tmp/cc38u8Jz.o(.text+0x4e): undefined reference to `PgConnection::~PgConnection
> (void)'
> collect2: ld returned 1 exit status
>
> What am I doing wrong?
>
> Shane Hansen
>

Are you linking youur program with the libpq++ library?  Usually, with g++
I compile programs with
g++ -lpq++ -L /path/to/pgsql/lib -I /path/to/pgsql/include

Hope that helps!

Randy Jonasz
Software Engineer
Click2net Inc.
Web:  http://www.click2net.com
Phone: (905) 271-3550

"You cannot possibly pay a philosopher what he's worth,
but try your best" -- Aristotle


In response to

pgsql-interfaces by date

Next:From: Jan T. KimDate: 2001-03-30 19:20:49
Subject: Re: [ADMIN] User administration tool
Previous:From: Bruce MomjianDate: 2001-03-30 15:48:54
Subject: Re: User administration tool

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group