I am trying to use libpq (C interface) to write client program to access PostGreSQL database.
I copied an example program from PostgreSQL: Introduction and Concepts by Bruce Momjian.
To compile the above said program, I did:
gcc -o ctest ctest.c /*I named the copied program as ctest.c*/
I got an error message, saying "libpq-fe.h not found".
In my linux RH7.1, I found libpq-fe.h in /usr/include/pgsql directory, so I replace the line '#include "libpq-fe.h"' in ctest.c with'#include "/usr/include/pgsql/libpq-fe.h"'. I did not get the above-said error, but the followings:
/tmp/ccgwexRo.0: In function 'main':
/tmp/ccgwexRr.o(.txt+0x12): undefined reference to 'PQconnectdb'
/tmp/ccgwexRr.o(.txt+0x2b): undefined reference to 'PQstatus'
/tmp/ccgwexRr.o(.txt+0x5c): undefined reference to 'PQerrorMessage'
/tmp/ccgwexRr.o(.txt+0xd4): undefined reference to 'PQexec'
7 more lines like these.
Having these errors, I obviously have not done things correctly.
Do I have to do any setting in gcc or compilation has to be done differently.
Any help would be highly appreciated.
pgsql-interfaces by date
|Next:||From: Michael Meskes||Date: 2001-11-01 10:12:55|
|Subject: Re: ECPG: Automatic Storage allocation for NULL-pointing|
|Previous:||From: Miller, Sam||Date: 2001-10-31 17:39:18|
|Subject: Re: DAO VB ODBC "read only problems|