Skip site navigation (1) Skip section navigation (2)


From: John Burski <John(dot)Burski(at)911ep(dot)com>
To: amp(at)foomonkey(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re:
Date: 2001-11-12 20:39:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On my Red Hat system, the library in question ("libpq.a") is located in 
the "/usr/lib" directory.  It's in the same directory on a machine with 
a Slackware distro.  You could assume that it can be found in the 
"/usr/lib" directory, but whenever I look for something on a Linux box I 
like to use the "locate" command.  For example, "locate libpq" returns a 
list of filenames that contain the string "libpq".  The list may be 
considerable, so you might want to pipe the output through your favorite 
paging program (I use "less").

As far as where you might get it if it doesn't exist:

The PostgreSQL rpms that I have on my system are as follows:


I'm not certain which one the libpq.a is actually resident in, but if I 
had to hazard a guess I'd pick the "devel" rpm.  Check to see which 
rpm's are installed.  I generated my list by running "rpm -qa | grep 
postgres".  Your PostgreSQL version might be different from mine - I'm 
running version 7.0.3 - I don't know which version is included on the 
Red Hat 7.2 distribution.  All of the relevant RPMs should be on your 
distribution CDs somewhere.

Hope this helps.

amp wrote:

> Thanks.  I assume this means I should have a file on my system named libpq.  If so, I can't find it. Where should it be located?  If I don't have it, where can I get it?  Is there an rpm somewhere that has development libraries?  I have checked out the rpms on my redhat cd's and I can't find it there either.  
> Also, should my command look like this?
>   gcc -Wall -o test1 test1.c -lpq
> I have the include file. It is in /usr/include/pgsql/libpq-fe.h.
> Thanks again.
> Andrew Pierce
> ---------- Original Message ----------------------------------
> From: John Burski <John(dot)Burski(at)911ep(dot)com>
> Date: Mon, 12 Nov 2001 11:53:56 -0600
>> Looks like you're missing the "-lpq" linker reference.
>> Also, don't forget to include the "/usr/include/pgsql/libpq-fe.h" file 
>> in your source.  (You know the drill ...  #include <pgsql/libpq-fe.h> )
>> Check out the Programmer docs closely, they helped me a lot.
>> Best regards,
>> amp wrote:
>>> Hello, 
>>> I have a new linux system running RedHat 7.2.  The Postgreqsl installation I have is the one that came with RH. I downloaded all the pdfs for Administration, Programmer, Tutorial, etc.  I am trying to write a simple C program to use the database I just created.  My command line looks like this: 
>>> gcc -Wall -o test1 test1.c 
>>> >From this, I get a long list of 'Undefined Reference' errors for any function that starts with 'PQ'. 
>>> I assume I am missing a library or something.  I am new to Linux programming (although I am an experienced C/C++ programmer under windows).   
>>> What am I missing? Thanks in advance. 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

John Burski
I.T. Manager and Systems Administration
911 Emergency Products, Inc.
25 Sixth Avenue North
Saint Cloud, MN  56303

800-863-6911, extension 221
FAX: 800-863-2991

In response to

  • Re: at 2001-11-12 19:51:07 from amp

pgsql-novice by date

Next:From: Josh BerkusDate: 2001-11-12 20:56:52
Subject: Re: XML & Postgresql
Previous:From: amp Date: 2001-11-12 19:51:07
Subject: Re:

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group