Hi, I would like to compile my simple test program, but I need to use static compilation. I'm using postgres 7.0.2 on debian 2.2 . Enviroment settings: LD_LIBRARY_PATH=/usr/local/pgsql/lib The whole install was done following readme in sources downloaded from www.postgresql.org I compile this attached source using: gcc admin.c -static -L/usr/local/pgsql/lib -lpq -lcrypt -Wall -o admin And I get error message like this: /usr/local/pgsql/lib/libpq.a(fe-connect.o): In function `defaultNoticeProcessor': fe-connect.o(.text+0x21ad): undefined reference to `_IO_stderr_' collect2: ld returned 1 exit status Thanks for any help Ice Planet
#include "libpq-fe.h" #include <unistd.h> char *dbname = "foo"; char *dbhost = "192.168.1.111"; char *dbport = "1111"; char *dbuser = "adminfoo"; char *dboptions = ""; char *dbtty = ""; char *dbpass = ""; PGconn* db; int a_uncon () /* Connect function. */ { db = PQsetdbLogin (dbhost,dbport,dboptions,dbtty,dbname,dbuser,dbpass); return (0); } int a_undcon () /* Disconnect database function. */ { PQfinish (db); return (0); } /* !!!!! ***** MAIN ***** !!!!! */ int main () { a_uncon (); sleep (1); a_undcon(); return (0); }