pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: J. T. Vermeulen <jtv@cistron-office.nl>
To: Shane Hansen <sl1fm@cc.usu.edu>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: c++ compile/link problem
Date: Fri, 30 Mar 2001 14:24:45 +0200
Message-ID: <20010330142445.G5047@cistron.nl> (raw)
In-Reply-To: <003601c0b8e3$b2693460$61e97b81@usu.edu>
References: <003601c0b8e3$b2693460$61e97b81@usu.edu>

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?

I'm assuming you've remembered to link to libpq++ here.

This may be a problem with your C++ compiler.  Different compilers, and in some
cases even different versions of the same compiler, mangle C++ identifiers
differently so they won't link to each other's code (and before you ask: yes,
there are good reasons for this--see the C++ FAQ :-).

Have you made sure your version of libpq++ was build with the same compiler?


Jeroen




view thread (3+ messages)  latest in thread

Message-ID: <20010330142445.G5047@cistron.nl>
Permalink:  ../20010330142445.G5047@cistron.nl/
Also on:    postgresql.org/message-id/20010330142445.G5047@cistron.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jtv@cistron-office.nl, sl1fm@cc.usu.edu
  Subject: Re: c++ compile/link problem
  In-Reply-To: <20010330142445.G5047@cistron.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox