Re: Problems linking with libpq - Mailing list pgsql-general

From Oliver Elphick
Subject Re: Problems linking with libpq
Date
Msg-id 200107280031.f6S0VJGn007770@linda.lfix.co.uk
Whole thread Raw
In response to Problems linking with libpq  (Flemming Froekjaer <flemming@froekjaer.org>)
List 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.Elphick@lfix.co.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



pgsql-general by date:

Previous
From: Flemming Froekjaer
Date:
Subject: Problems linking with libpq
Next
From: Justin Clift
Date:
Subject: Re: PostgreSQL to Dia program