Return-Path: owner-postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id BAA12525 for postgres-dist; Fri, 12 Nov 1993 01:01:08 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199311120901.BAA12525@nobozo.CS.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from faerie.CS.Berkeley.EDU (faerie.CS.Berkeley.EDU [128.32.149.14]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with ESMTP id BAA12516 for <postgres@nobozo.CS.Berkeley.EDU>; Fri, 12 Nov 1993 01:01:08 -0800
Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.6.3/8.1B) with SMTP id BAA03924; Fri, 12 Nov 1993 01:00:33 -0800
Message-Id: <199311120900.BAA03924@faerie.CS.Berkeley.EDU>
X-Authentication-Warning: faerie.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
From: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
To: yprj2167@cs.cuhk.hk (Final Year Project)
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: Problem about LIBPQ 
In-reply-to: Your message of Fri, 12 Nov 93 11:45:50 +0800 
	     <9311120345.AA23279@cucs18.cs.cuhk.hk> 
Date: Fri, 12 Nov 93 01:00:33 -0800
X-Sender: aoki@postgres.Berkeley.EDU
Resent-To: postgres-dist@postgres.Berkeley.EDU
X-Mts: smtp
Resent-Date: Fri, 12 Nov 93 01:01:08 -0800
Resent-XMts: smtp

general note for everyone: if you have something that you think
may be a FAQ (frequently-asked question), send it to 
post_questions@postgres instead of postgres@postgres.  the
latter is the general mailing list of all users..

yprj2167@cs.cuhk.hk (Final Year Project) writes:
> I have gone through the ref.ps. But I can't find the part about
> the compilation of C files. Can you tell me where it is?

i usually just tell people to use the same -I directives that 
they would use to build dynamically-loaded functions.  this
discussion is in the user manual and the "define function"
man page.  in fact, it's pretty much the only discussion of
compiling *anything* in the whole manual right now (except in
the large object section), so people usually just stumble across 
it :-P  (most people can figure out how to link against libpq.a
so -L and -l directives have not been a problem. :-)  if you 
look in the source tree, that's also how we build the frontend 
apps that come with postgres.

at the last minute, marc decided that this was a crufty way
to do things (since you have to leave the source tree around).
now, in theory, the include/ and lib/ directories should hold 
everything you need for building libpq apps.  however, this is
essentially an undocumented feature and, in point of fact,
what's in include/ is not complete (this is noted in the 
postgres-setup file, which requests feedback on this matter).

the short answer is, if "..." is where postgres is installed,
you need something like
	cc <stuff> -I.../include -L.../lib <more stuff> -lpq
however, this sometimes gives you "can't find <blah>.h", in 
which case you need to stick in the -I directives from "define 
function" anyway.

if you have feedback about missing stuff in include/, send mail 
to bug-postgres@postgres.

(the documentation has been in pretty bad shape for a long time,
and is undergoing a general overhaul..)

> My working directory is not the postgres directory. I want to ask
> whether I have to change the path of the header files to be included
> in other header files.

use the right -I directives and /bin/cc will do the rest. :-)
however, as mentioned, the right -I directives depend on where
your sysadmin installed stuff..

> Also, in SAMPLE PROGRAM 1 on p.120 of ref.ps, why only libpq.h is 
> included ? The function PQexec, PQsetdb are not found in libpq.h.
> Is the program OK ? Is libpq.h the only header file to be included
> when using the LIBPQ functions ?  Thanks.

"tmp/libpq-fe.h" is also often useful and includes libpq.h.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki
