From: | Lars Heidieker <lars(at)heidieker(dot)de> |
---|---|
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:21:16 |
Message-ID: | D22F7145-891A-4F79-84C1-59CCF8904E2D@heidieker.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10 Oct 2007, at 02:25, pgsql(dot)gen(at)tuxbeagle(dot)com wrote:
> I was trying this example program out of a well known postgresql
> book and keep getting errors whenever I try to compile.
>
> Error messages ##make client1
>
> 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
> make: *** [client1] Error 1
> ---------------------------------------------------------
>
>
you must add -lpq too your LDFLAGS
in order to link the lib you only have the linker paths set in LDFLAGS
it should read like this then:
cc -g client1.o -L /usr/lib -L /usr/lib/pgsql -o client1 -lpq
--
Viele Grüße,
Lars Heidieker
lars(at)heidieker(dot)de
http://paradoxon.info
------------------------------------
Mystische Erklärungen.
Die mystischen Erklärungen gelten für tief;
die Wahrheit ist, dass sie noch nicht einmal oberflächlich sind.
-- Friedrich Nietzsche
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-10-14 15:56:27 | Re: Using C API |
Previous Message | Trevor Talbot | 2007-10-14 14:41:10 | Re: atomic commit; begin for long running transactions , in combination with savepoint. |