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

Re: Compiling Test Programs

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Scott Holmes <sholmes(at)pacificnet(dot)net>
Cc: PG-Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Compiling Test Programs
Date: 2001-05-15 14:24:26
Message-ID: Pine.LNX.4.30.0105151623420.757-100000@peter.localdomain (view raw, whole thread or download thread mbox)
Lists: 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(at)gmx(dot)net

In response to

pgsql-interfaces by date

Next:From: Chris HaynerDate: 2001-05-15 20:32:10
Subject: help with programming
Previous:From: Michael Ansley (UK)Date: 2001-05-15 11:53:10
Subject: RE: How to connect via C++?

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