Sewaktu saya mencoba compile testlibpq.c untuk coba akses ke postgres
database engine, terdapat pesan error :
"undefined reference to PQfinish"
"undefined reference to PQsetdb", undefined to ...dst...dst
Please kalao ada yg tahu,.... mengapa itu terjadi & pemecahannya bagaimana ?
Thanks
----------Berikut cuplikan testlibpq.c-----------------------
/*
* testlibpq.c
* Test the C version of Libpq, the Postgres frontend library.
*
*
*/
#include <stdio.h>
#include <libpq-fe.h>
void
exit_nicely(PGconn* conn)
{
PQfinish(conn);
exit(1);
}
main()
{
char *pghost, *pgport, *pgoptions, *pgtty;
char *dbName;
int nFields;
int i,j;
/* FILE *debug; */
PGconn* conn;
PGresult* res;
/* begin, by setting the parameters for a backend connection
if the parameters are null, then the system will try to use
reasonable defaults by looking up environment variables
or, failing that, using hardwired constants */
pghost = NULL; /* host name of the backend server */
pgport = NULL; /* port of the backend server */
pgoptions = NULL; /* special options to start up the backend server
*/
pgtty = NULL; /* debugging tty for the backend server */
dbName = "template1";
/* make a connection to the database */
conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
/* check to see that the backend connection was successfully made
*/
--------------------end of cuplikan--------------------
-------------------versi libpq-fe.h---------
*
* libpq-fe.h--
* This file contains definitions for structures and
* externs for functions used by frontend postgres applications.
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-fe.h,v 1.28 1998/03/20 04:02:57 momjian Exp $
*
-------
NB :
--------------------------------------------------------------------------------
Utk berhenti langganan, kirim email ke [EMAIL PROTECTED]
Informasi arsip di http://www.linux.or.id/milis.php3
Pengelola dapat dihubungi lewat [EMAIL PROTECTED]
Hosted by http://www.Indoglobal.com