compiling ...

Started by mikeover 24 years ago2 messagesgeneral
Jump to latest
#1mike
mike@tkosys.com

Hi Folks,

"cc -O -o pgsample pgsample.c -L/usr/local/pgsql/lib -lpq" went thru.

Then I did "make pgsample.o".

After that "make pgsample", this process gave me original errors:

pgsample.o: In function `main':
pgsample.o(.text+0x12): undefined reference to `PQconnectdb'
pgsample.o(.text+0x2b): undefined reference to `PQstatus'
pgsample.o(.text+0x5c): undefined reference to `PQerrorMessage'
pgsample.o(.text+0xd0): undefined reference to `PQexec'
pgsample.o(.text+0xe9): undefined reference to `PQresultStatus'
pgsample.o(.text+0x117): undefined reference to `PQclear'
pgsample.o(.text+0x128): undefined reference to `PQfinish'
pgsample.o(.text+0x152): undefined reference to `PQntuples'
pgsample.o(.text+0x17d): undefined reference to `PQgetvalue'
pgsample.o(.text+0x1aa): undefined reference to `PQclear'
pgsample.o(.text+0x1bb): undefined reference to `PQfinish'
collect2: ld returned 1 exit status
make: *** [pgsample] Error 1

Anyone know the solution for this?
Thanks.

--
Best Regards,

Mike
TKO Systems, Ltd.

#2Holger Klawitter
lists@klawitter.de
In reply to: mike (#1)
Re: compiling ...

mike wrote:

"cc -O -o pgsample pgsample.c -L/usr/local/pgsql/lib -lpq" went thru.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You have to put the marked part into the rule for the linker.

With kind regards / Mit freundlichem Gru�
Holger Klawitter
--
Holger Klawitter
holger@klawitter.de http://www.klawitter.de