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

Re: c++ compile/link problem

From: "J(dot) T(dot) Vermeulen" <jtv(at)cistron-office(dot)nl>
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 12:24:45
Message-ID: 20010330142445.G5047@cistron.nl (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?

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


In response to

pgsql-interfaces by date

Next:From: D'Arcy J.M. CainDate: 2001-03-30 12:36:29
Subject: Re: mod_auth_pgsql
Previous:From: Shane HansenDate: 2001-03-30 06:36:05
Subject: c++ compile/link problem

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