Received: from bubba.NMSU.Edu (bubba.NMSU.Edu [128.123.3.39]) by hub.org (8.8.8/8.7.5) with ESMTP id LAA18392 for ; Thu, 3 Sep 1998 11:41:58 -0400 (EDT) Received: from dns1.NMSU.Edu (dns1.NMSU.Edu [128.123.3.5]) by bubba.NMSU.Edu (8.9.0/8.9.0) with ESMTP id JAA19121 for ; Thu, 3 Sep 1998 09:42:49 -0600 (MDT) Received: from nestor.NMSU.Edu (nestor.NMSU.Edu [128.123.34.146]) by dns1.NMSU.Edu (8.9.0/8.9.0) with ESMTP id JAA14185 for ; Thu, 3 Sep 1998 09:41:43 -0600 (MDT) Received: from nbif16 (nbif16.NMSU.Edu [128.123.15.254]) by nestor.NMSU.Edu (8.8.6/8.7) with SMTP id JAA184320 for ; Thu, 3 Sep 1998 09:41:43 -0600 Message-ID: <35EEBB94.34A3@cs.nmsu.edu> Date: Thu, 03 Sep 1998 09:53:56 -0600 From: rhayhow Reply-To: rhayhow@cs.nmsu.edu Organization: National Biotechnology Information Facility X-Mailer: Mozilla 3.03Gold (WinNT; I) MIME-Version: 1.0 To: pgsql-interfaces@hub.org Subject: ecpg and embedded SQL References: <199809030300.XAA22557@hub.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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