Thread: Problems with c, compiling, libraries

Problems with c, compiling, libraries

From
"Kirby Krueger"
Date:
Greetings.

I'm trying to compile a C program that connects to a postgreSQL database.
I'm successfully getting past the compile step, with:
#include "/usr/include/pgsql/libpq-fe.h"

However, in the link step, I get lots of things like:
/home/kirbyk/ugxProcessTurn.c:1954: undefined reference to `PQexec'
/home/kirbyk/ugxProcessTurn.c:1955: undefined reference to `PQresultStatus'
/home/kirbyk/ugxProcessTurn.c:1958: undefined reference to `PQclear'
/home/kirbyk/ugxProcessTurn.c:1960: undefined reference to `PQgetvalue'
/home/kirbyk/ugxProcessTurn.c:1961: undefined reference to `PQgetvalue'
/home/kirbyk/ugxProcessTurn.c:1975: undefined reference to `PQexec'

... and so on.

I suspect that some libraries didn't get installed in the right place.  I'm
not responsible for that sort of thing, but the guy who is claimed that he
installed all the development packages for postgreSQL.

I don't see anything that would be useful in /usr/lib.  There is a
/usr/lib/pgsql, which contains:
plpgsql.so*  pltcl.so*

I tried including these in the link step, but they clearly are for some
purpose other than the functions in libpq-fe.h.

Can someone give me some pointers?  My productivity has ground to a
screeching halt trying to figure this out.  The names of the libraries I
ought to have installed would be very helpful; what rpms to get them from
would be even moreso.  We're running a recent version of RedHat Linux.

Thanks for any assistance!

-- Kirby


Re: Problems with c, compiling, libraries

From
HK
Date:
hi kirby,
    compile ur C program with -lpq. That should solve it.
regards,
hari

On Fri, 11 Oct 2002, Kirby Krueger wrote:

> Greetings.
>
> I'm trying to compile a C program that connects to a postgreSQL database.
> I'm successfully getting past the compile step, with:
> #include "/usr/include/pgsql/libpq-fe.h"
>
> However, in the link step, I get lots of things like:
> /home/kirbyk/ugxProcessTurn.c:1954: undefined reference to `PQexec'
> /home/kirbyk/ugxProcessTurn.c:1955: undefined reference to `PQresultStatus'
> /home/kirbyk/ugxProcessTurn.c:1958: undefined reference to `PQclear'
> /home/kirbyk/ugxProcessTurn.c:1960: undefined reference to `PQgetvalue'
> /home/kirbyk/ugxProcessTurn.c:1961: undefined reference to `PQgetvalue'
> /home/kirbyk/ugxProcessTurn.c:1975: undefined reference to `PQexec'
>
> ... and so on.
>
> I suspect that some libraries didn't get installed in the right place.  I'm
> not responsible for that sort of thing, but the guy who is claimed that he
> installed all the development packages for postgreSQL.
>
> I don't see anything that would be useful in /usr/lib.  There is a
> /usr/lib/pgsql, which contains:
> plpgsql.so*  pltcl.so*
>
> I tried including these in the link step, but they clearly are for some
> purpose other than the functions in libpq-fe.h.
>
> Can someone give me some pointers?  My productivity has ground to a
> screeching halt trying to figure this out.  The names of the libraries I
> ought to have installed would be very helpful; what rpms to get them from
> would be even moreso.  We're running a recent version of RedHat Linux.
>
> Thanks for any assistance!
>
> -- Kirby
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>