From: | rhayhow <rhayhow(at)cs(dot)nmsu(dot)edu> |
---|---|
To: | pgsql-interfaces(at)hub(dot)org |
Subject: | ecpg and embedded SQL |
Date: | 1998-09-03 15:53:56 |
Message-ID: | 35EEBB94.34A3@cs.nmsu.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Delahoyde | 1998-09-03 16:12:42 | Re: [INTERFACES] postodbc on sparc2.5.1 |
Previous Message | Frank Morton | 1998-09-03 15:44:48 | add/delete field utility? |