Re:
От | amp |
---|---|
Тема | Re: |
Дата | |
Msg-id | 200111140941.AA662306916@foomonkey.com обсуждение исходный текст |
Ответ на | ("calios" <calios@celcom.net.my>) |
Список | pgsql-novice |
I found the library. Mine is in /usr/lib also. I was looking for a file named libpq, not libpq.a. I was using the findcommand. The locate command worked better. Also, I did not realize that the linker would assume the prefix "lib" and the suffix ".a". When I compiled with a commandlike this: gcc -Wall -o test1 test1.c -lpq it worked! Thanks for your help! Andrew ---------- Original Message ---------------------------------- From: John Burski <John.Burski@911ep.com> Date: Mon, 12 Nov 2001 14:39:50 -0600 >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: > > postgresql-perl-7.0.3-2 > postgresql-python-7.0.3-2 > postgresql-tcl-7.0.3-2 > postgresql-jdbc-7.0.3-2 > postgresql-devel-7.0.3-2 > postgresql-odbc-7.0.3-2 > postgresql-tk-7.0.3-2 > postgresql-7.0.3-2 > postgresql-server-7.0.3-2 > postgresql-test-7.0.3-2 > >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 belocated? If I don't have it, where can I get it? Is there an rpm somewhere that has development libraries? I have checkedout 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.Burski@911ep.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 downloadedall the pdfs for Administration, Programmer, Tutorial, etc. I am trying to write a simple C program to use thedatabase 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++ programmerunder windows). >>>> >>>> What am I missing? Thanks in advance. >>>> >> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >> >> > >-- >John Burski >I.T. Manager and Systems Administration >911 Emergency Products, Inc. >25 Sixth Avenue North >Saint Cloud, MN 56303 >John.Burski@911ep.com > >800-863-6911, extension 221 >FAX: 800-863-2991 >www.911ep.com > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > >http://archives.postgresql.org >
В списке pgsql-novice по дате отправления: