pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rhayhow <rhayhow@cs.nmsu.edu>
To: pgsql-interfaces@hub.org
Subject: ecpg and embedded SQL
Date: Thu, 03 Sep 1998 09:53:56 -0600
Message-ID: <35EEBB94.34A3@cs.nmsu.edu> (raw)
References: <199809030300.XAA22557@hub.org>

Hi,

	I am trying to compile a simple program with embedded SQL and have had
a number of problems. My goal is to get a small, simple program that
will connect to and communicate with our database before moving on to a
larger project. I am using Postgres 6.3.2 on a Solaris 2.6 machine. I am
new to Postgres and embedded SQL, so go easy on me.
	 I have read the documentation and have searched through both
mailing-list archives, and both were helpful. Unfortunately they have
not been enough to let me finish this project. I am trying to compile
Thomas Good's sample code from http://www.panix.com/~ugd/recipe.html. I
cleared out the Perl code to simplify things. Anyway, when I try to
compile using...

	#!/bin/sh
	 tput clear
	 echo -ne "Enter name of code file [ omit .pgc ]: "
	 read file
	 ecpg -o $file.c $file.pgc
	 PGBASE="/usr/local/postgresql"
	 gcc -g -I ${PGBASE}/include -I ${PGBASE}/libpq -o $file $file.c -L
${PGBASE}/lib 
	     -lecpg -lpq 

I get the following errors...

/usr/local/postgresql/lib/libpq.a(fe-connect.o): In function
`connectDB':
fe-connect.o(.text+0xf6c): undefined reference to `gethostbyname'
fe-connect.o(.text+0x10e0): undefined reference to `socket'
fe-connect.o(.text+0x116c): undefined reference to `connect'
fe-connect.o(.text+0x1218): undefined reference to `getprotobyname'
fe-connect.o(.text+0x127c): undefined reference to `setsockopt'
fe-connect.o(.text+0x12e0): undefined reference to `getsockname'

I have looked at fe-connect.o and it '#includes' two header files,
'socket.h' and 'netdb.h', that contain all of these functions. The files
'socket.h' and 'netdb.h' appear to be fine, so I don't understand what
the problem is. Is there a problem with the linking of libpq.a? Any help
would be greatly appreciated. Thanks.

Reid Hayhow
NBIF
New Mexico State University



view thread (3+ messages)  latest in thread

Message-ID: <35EEBB94.34A3@cs.nmsu.edu>
Permalink:  ../35EEBB94.34A3@cs.nmsu.edu/
Also on:    postgresql.org/message-id/35EEBB94.34A3@cs.nmsu.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rhayhow@cs.nmsu.edu, pgsql-interfaces@hub.org
  Subject: Re: ecpg and embedded SQL
  In-Reply-To: <35EEBB94.34A3@cs.nmsu.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox