pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Compiling Test Programs
2+ messages / 2 participants
[nested] [flat]

* Compiling Test Programs
@ 2001-05-15 00:21  Scott Holmes <sholmes@pacificnet.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Scott Holmes @ 2001-05-15 00:21 UTC (permalink / raw)
  To: pgsql-interfaces

I am by no means a C programmer and I don't know much about Makefiles so I 
need a little assistance here.  I have Postgresql7.1 compiled from the tar 
ball and it's working fine.  But now I need to write a program using libpg.  I 
have psql working fine as well as PHP4 so I've assumed libpg has been included 
in my installation.  But when I go to compile testlibpq.c  I get:

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations 
-I../../../src/interfaces/libpq -I../../../src/include   
-Wl,-rpath,/usr/local/pgsql/lib  testlibpq.c   -o testlibpq
/tmp/ccy2shMg.o: In function `exit_nicely':
/tmp/ccy2shMg.o(.text+0x7): undefined reference to `PQfinish'
/tmp/ccy2shMg.o: In function `main':
/tmp/ccy2shMg.o(.text+0x30): undefined reference to `PQsetdbLogin'
/tmp/ccy2shMg.o(.text+0x39): undefined reference to `PQstatus'
...
/tmp/ccy2shMg.o(.text+0x205): undefined reference to `PQfinish'
collect2: ld returned 1 exit status
make: *** [testlibpq] Error 1

I do have /usr/local/pgsql/lib/libpq.a

Perhaps someone can point me in the proper direction.






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Compiling Test Programs
@ 2001-05-15 14:24  Peter Eisentraut <peter_e@gmx.net>
  parent: Scott Holmes <sholmes@pacificnet.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2001-05-15 14:24 UTC (permalink / raw)
  To: Scott Holmes <sholmes@pacificnet.net>; +Cc: pgsql-interfaces

Scott Holmes writes:

> gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations
> -I../../../src/interfaces/libpq -I../../../src/include
> -Wl,-rpath,/usr/local/pgsql/lib  testlibpq.c   -o testlibpq
> /tmp/ccy2shMg.o: In function `exit_nicely':
> /tmp/ccy2shMg.o(.text+0x7): undefined reference to `PQfinish'
> /tmp/ccy2shMg.o: In function `main':
> /tmp/ccy2shMg.o(.text+0x30): undefined reference to `PQsetdbLogin'
> /tmp/ccy2shMg.o(.text+0x39): undefined reference to `PQstatus'
> ...
> /tmp/ccy2shMg.o(.text+0x205): undefined reference to `PQfinish'
> collect2: ld returned 1 exit status
> make: *** [testlibpq] Error 1

You need to link against libpq.  Add '-lpq' to the compilation line.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-05-15 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-15 00:21 Compiling Test Programs Scott Holmes <sholmes@pacificnet.net>
2001-05-15 14:24 ` Peter Eisentraut <peter_e@gmx.net>

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