Thread: Re: [INTERFACES] Re: Postgres and port unavailable?

Re: [INTERFACES] Re: Postgres and port unavailable?

From
Peter T Mount
Date:
On Thu, 16 Apr 1998, matthew e perkowski cis stnt wrote:

> Hello,
>
>
> I can create a database and gave worked with my template1 database. Now, I
> want to test the LIBPQ interface with testclib.c. I can compile and run
> c/c++ programs, start the postmaster, and use psql successfully. Question:
> when I want to compile the testclib.c program( I made sure my header files
> in the program were in the correct place and were referred to correctly)
> with my command line:
>
> gcc testclib.c  -I/usr/include/pgsql -L/usr/include/pgsql/lib -o project

Youre missing -lpq. the -L only defines where the libraries are located,
but doesn't tell the linker which ones to use.

gcc testclib.c  -I/usr/include/pgsql -L/usr/include/pgsql/lib -lpq -o project

That should work

--
Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk



Re: [INTERFACES] Re: Postgres and port unavailable?

From
matthew e perkowski cis stnt
Date:
# .cshrc


# User specific aliases and functions


alias rm 'rm -i'

alias cp 'cp -i'

alias mv 'mv -i'


# setenv PATH="/usr/sbin:/sbin:$PATH"

set path=(. $home/bin /usr/local/bin /bin /usr/bin /usr/sbin

/usr/X11R6/bin

/usr/andrew/bin /usr/openwin/bin /usr/games /sbin)

setenv LD_LIBRARY_PATH /home/matt/Mesa-2.5/lib /usr/include/pgsql/lib

/lib /var/lib

setenv PGDATA /usr/data

setenv PGLIB /usr/lib /lib /var/lib/pgsql /usr/include/pgsql/lib

set prompt=\[`id -nu`@`hostname -s`\]\#\

My .cshrc file is above and my libpq.a is in /usr/local/lib/ and /usr/lib.
See any necccessary changes in the .cshrc file? The command line you sent
me has the -lpq, is this for libpq-fe.h or for
libpq.a? Also, any linking involved after this and what is the procedure
for libpq++(no docs decribing this on web), what files needed, etc. Much
thanks. M. Perkowski


Re: [INTERFACES] Re: Postgres and port unavailable?

From
Peter T Mount
Date:
On Fri, 17 Apr 1998, matthew e perkowski cis stnt wrote:

[snip]

> My .cshrc file is above and my libpq.a is in /usr/local/lib/ and /usr/lib.
> See any necccessary changes in the .cshrc file? The command line you sent
> me has the -lpq, is this for libpq-fe.h or for
> libpq.a?

The -lpq tells the linker what library you want to link in (and relates to
libpq.a).

> Also, any linking involved after this and what is the procedure
> for libpq++(no docs decribing this on web), what files needed, etc. Much
> thanks. M. Perkowski

I'm not sure for libpq++ as thats for C++, and I've never used it.

--
Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk