pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedc++ compile/link problem
3+ messages / 3 participants
[nested] [flat]
* c++ compile/link problem
@ 2001-03-30 06:36 Shane Hansen <sl1fm@cc.usu.edu>
2001-03-30 12:24 ` Re: c++ compile/link problem J. T. Vermeulen <jtv@cistron-office.nl>
2001-03-30 17:08 ` Re: c++ compile/link problem Randy Jonasz <rjonasz@click2net.com>
0 siblings, 2 replies; 3+ messages in thread
From: Shane Hansen @ 2001-03-30 06:36 UTC (permalink / raw)
To: pgsql-interfaces
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: c++ compile/link problem
2001-03-30 06:36 c++ compile/link problem Shane Hansen <sl1fm@cc.usu.edu>
@ 2001-03-30 12:24 ` J. T. Vermeulen <jtv@cistron-office.nl>
1 sibling, 0 replies; 3+ messages in thread
From: J. T. Vermeulen @ 2001-03-30 12:24 UTC (permalink / raw)
To: Shane Hansen <sl1fm@cc.usu.edu>; +Cc: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: c++ compile/link problem
2001-03-30 06:36 c++ compile/link problem Shane Hansen <sl1fm@cc.usu.edu>
@ 2001-03-30 17:08 ` Randy Jonasz <rjonasz@click2net.com>
1 sibling, 0 replies; 3+ messages in thread
From: Randy Jonasz @ 2001-03-30 17:08 UTC (permalink / raw)
To: Shane Hansen <sl1fm@cc.usu.edu>; +Cc: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-03-30 17:08 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-30 06:36 c++ compile/link problem Shane Hansen <sl1fm@cc.usu.edu>
2001-03-30 12:24 ` J. T. Vermeulen <jtv@cistron-office.nl>
2001-03-30 17:08 ` Randy Jonasz <rjonasz@click2net.com>
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