Re: libpq++ compiling errors...

From: "isaac flemmin" <isaac(at)knox(dot)net>
To: "'Oliver Elphick'" <olly(at)lfix(dot)co(dot)uk>
Cc: <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libpq++ compiling errors...
Date: 2002-01-30 08:52:48
Message-ID: 000201c1a96b$7e816a90$dcad2204@ixic
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


Thanks for the reply,

I do know that I have included <string.h> for other programs, and that
it does not have anything to do with C++ Strings. I will just not use
libpq++ if is not tested or of poor quality. I am fine using libpq, it
really does not matter to me. I was just hoping one or the other would
work for me. So with that said, is there anything else that might be
causing these errors other than string.h, and if not how do I get the
libpq libraries to work with string.h?

When I try to add -lpq to the link options I get libpq.so.2 not found.
Is there a something special I need to do to add that? Here is the
command's I have tried.

First I compile without linking.
gcc -c testlibpq.c -I/usr/local/pgsql/include/

Then I link using the -lpq and the directory is is in
gcc -o testlibpq testlibpq.o -L/usr/local/pgsql/lib/ -lpq

Then I try to run the program.
./testlibpq
./testlibpq: error while loading shared libraries: libpq.so.2: cannot
open shared object file: No such file or directory

Since it does not seem to be able to find it I try looking at what all
it needs using the ldd command. Once again it says not found.
ldd testlibpq
libpq.so.2 => not found
libc.so.6 => /lib/i686/libc.so.6 (0x4001b000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

So now I actually look for the library myself, and it is obviously on
the computer in several place.
locate libpq.so.2
/home/tech/isaac/postgres/postgresql-7.1.3/src/interfaces/libpq/libpq.so
.2.1
/home/tech/isaac/postgres/postgresql-7.1.3/src/interfaces/libpq/libpq.so
.2
/home/tech/isaac/postgres/postgresql-7.1.3/src/test/regress/tmp_check/in
stall/usr/local/pgsql/lib/libpq.so.2
/home/tech/isaac/postgres/postgresql-7.1.3/src/test/regress/tmp_check/in
stall/usr/local/pgsql/lib/libpq.so.2.1
/usr/local/pgsql/lib/libpq.so.2
/usr/local/pgsql/lib/libpq.so.2.1

I have never installed any libraries on a Linux system before. Are there
any tutorials out there that can teach me how to do this, or does anyone
know how to do it that would not mind telling me. I am currently looking
for anything I can find but am not having much luck. I will continue
looking but if anyone can help push me in the right direction I would be
very grateful.

Thanks for all the help so far.
Isaac

-----Original Message-----
From: pgsql-interfaces-owner(at)postgresql(dot)org
[mailto:pgsql-interfaces-owner(at)postgresql(dot)org] On Behalf Of Oliver
Elphick
Sent: Tuesday, January 29, 2002 10:53 PM
To: isaac flemmin
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [INTERFACES] libpq++ compiling errors...

On Wed, 2002-01-30 at 00:53, isaac flemmin wrote:

> g++ -I/usr/local/pgsql/include -o testlibpq0 testlibpq0.cc
> -L/usr/local/pgsql/lib -lpq++
>
> In file included from ../libpq++.h:27,
>
> from testlibpq0.cc:18:
>
> /usr/local/pgsql/include/libpq++/pgconnection.h:85: syntax error
before
> `('
>
> In file included from ../libpq++.h:29,
>
> from testlibpq0.cc:18:
>
> /usr/local/pgsql/include/libpq++/pglobject.h:36: syntax error before
`;'

I have very little experience of C++, but all these errors relate to the
string class; it appears not to be provided by your class library.
pgconnection.h appears to contemplate the possibility, since the
inclusion of string.h is enclosed in an #ifdef, but there is no
alternative provided.

I think that libpq++ is very poorly tested. If you look back in the
archives a week or two, you will find mention of a new C++ interface
that would replace libpq++.

> gcc -Wl,-rpath,/usr/local/pgsql/lib testlibpq.o -o testlibpq
>
> testlibpq.o: In function `main':
>
> testlibpq.o(.text+0x1c): undefined reference to `PQsetdbLogin'

This is a link error; the command does not link the libpq library into
the executable. You need to add "-lpq" to the link options.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

"The Lord knoweth how to deliver the godly out of
temptations, and to reserve the unjust unto the day of
judgment to be punished;" II Peter 2:9

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Andreas Kretzer 2002-01-30 10:40:03 Re: libpq++ compiling errors...
Previous Message Oliver Elphick 2002-01-30 06:52:57 Re: libpq++ compiling errors...