Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA19626; Mon, 11 Jan 93 11:14:49 -0800
Date: Mon, 11 Jan 93 11:14:49 -0800
From: Phil Shen <philshen@cs.washington.edu>
Subject: Still having problems compiling with LIBPQ
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
To: postgres@postgres.berkeley.edu
Cc: Philip Shen <philshen@cs.washington.edu>
Message-Id: <Pine.3.05.9301111152.B27215-b100000@wolf.cs.washington.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII


Hi,

First of all, I would appreciate any and all help in this problem.  My
experience with Postgres and C is very much limited, (this is my first
time using Postgres and LIBPQ) so any corrections/suggestions/pointers
would be helpful.  The more specific the better.  :)

I'm on a Sun system running 4.1.2, and I'm trying to get an executable
from the C code.

This is what I am trying to compile (realizing that it may not be correct
code):

#include <stdio.h>
#include <tmp/libpq.h>
#include <tmp/c.h>
#include <tmp/postgres.h>

main()
{
/*   (text *) Name;*/
   int4 Id;

   PQsetdb("db2");
   PQexec("begin");
   printf("\nEnter an id: ");
   scanf("%d",&Id);
   PQexec("retrieve (KBTERMS.name) where (KBTERMS.id =%ld)",Id);
   PQfinish();
 }


When I compile, I use this statement and get these error messages:

lillith% cc -I$POSTGRESHOME/src/lib/H -I$POSTGRESHOME/src/port/$PORTNAME -o
test3 test3.c libpq.a
ld: libpq.a: warning: table of contents for archive is out of date; rerun
ranlib(1) 
ld: Undefined symbol 
   _elog 
   _dump_data 
   _form 
   _pfree 
   _ExcRaise 
   _palloc 
Compilation failed
lillith% test3
ld.so: Undefined symbol: _form
lillith%

(lillith is a Sun system running version 4.1.2, I believe)  The
environment variables I believe are set correctly--$Postgreshome is set to
postgres, and $portname is set to sunos4.  I believe the cc command is Sun
C version 1.1.

Again, any information you can tell me is appreciated, even pointers to
other sources of info.  Please send E-mail to PHILSHEN@CS.WASHINGTON.EDU if
you don't want to post to this group.

Thanks very much in advance,
Phil




