linking error

From: "anuj" <Anuj(at)in-control(dot)de>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: linking error
Date: 2000-06-13 10:56:16
Message-ID: 005101bfd526$094bf670$6a01010a@incontrolint.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear sir,
This is a small sample 'C' program.
Compile successfully and linking error is coming in PQsetdb function.
This program will run on Linux RH6. How to remove this linking error.
Please waiting your valuable guidance.
Thanx.

******* Compile Result ************
[rootanuj(at)Lux2 rootanuj]$ gcc -S conn.c
[rootanuj(at)Lux2 rootanuj]$ gcc conn.c
/tmp/ccroTWA2.o: In function `main':
/tmp/ccroTWA2.o(.text+0x48): undefined reference to `PQsetdbLogin'
collect2: ld returned 1 exit status
[rootanuj(at)Lux2 rootanuj]$
*******************************

/* conn.c */
#include <stdio.h>
#include "/usr/include/pgsql/libpq-fe.h"
main()
{
char *pghost,
*pgport,
*pgoptions,
*pgtty;
char *dbName;

PGconn *conn;

pghost = NULL; /* host name of the backend server */
pgport = "5432"; /* 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 = PQsetdbLogin(pghost, pgport, pgoptions,
pgtty,dbName,"username","password");
/* Compile successfully and linking error is coming in PQsetdb function. */
/* Compile cc -S conn.c */
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-06-13 12:38:39 Re: Gripe: working on configure now requires Automake installed locally
Previous Message Vince Vielhaber 2000-06-13 10:19:12 Re: Big 7.1 open items