Re: Using C API

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql(dot)gen(at)tuxbeagle(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using C API
Date: 2007-10-14 15:56:27
Message-ID: 27605.1192377387@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pgsql(dot)gen(at)tuxbeagle(dot)com writes:
> I was trying this example program out of a well known postgresql book and keep getting errors whenever I try to compile.

> cc -g -I /usr/include -I /usr/include/pgsql -I /usr/include/pgsql/server -c -o client1.o client1.c
> cc -g client1.o -L /usr/lib -L /usr/lib/pgsql -o client1
> client1.o: In function `main':
> /root/PROGRAMMING/C_API/client1.c:10: undefined reference to `PQconnectdb'
> /root/PROGRAMMING/C_API/client1.c:11: undefined reference to `PQfinish'
> collect2: ld returned 1 exit status

You're missing "-lpq" in the link step. I think most or all of those -I
and -L switches are useless, also.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-10-14 15:58:48 Re: Aggregate View and Conditions taking FOREVER
Previous Message Lars Heidieker 2007-10-14 15:21:16 Re: Using C API