Re: Problems linking with libpq

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: Flemming Froekjaer <flemming(at)froekjaer(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problems linking with libpq
Date: 2001-07-28 00:31:19
Message-ID: 200107280031.f6S0VJGn007770@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Flemming Froekjaer wrote:
>I'm trying to compile a small c program that integrates with PostgreSQL,
>
>but when I get to link the prog i get the following error.
>
>/tmp/ccFrRISc.o: In function `main':
>/tmp/ccFrRISc.o(.text+0x57): undefined reference to `PQsetdbLogin'

It seems that you aren't in fact linking libpq to your program.

You need something like

gcc prog.c -L/usr/local/lib/pgsql -lpq

as a minimum.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"But the wisdom that is from above is first pure, then
peaceable, gentle, and easy to be intreated, full of
mercy and good fruits, without partiality, and without
hypocrisy." James 3:17

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2001-07-28 03:14:15 Re: PostgreSQL to Dia program
Previous Message Flemming Froekjaer 2001-07-27 22:49:36 Problems linking with libpq