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@Lux2 rootanuj]$ gcc -S conn.c
[rootanuj@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@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 */
  }



Tue, 13 Jun 2000 16:26:16 +0530
"anuj" <Anuj@in-control.de>
linking error
On Tue, 13 Jun 2000, anuj wrote:

> 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.

gcc conn.c -L/usr/local/pgsql/lib -lpg -o conn

Vince.

> 
> 
> ******* Compile Result ************
> [rootanuj@Lux2 rootanuj]$ gcc -S conn.c
> [rootanuj@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@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 */
>   }
> 
> 
> 

-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: vev@michvhf.com    http://www.pop4.net
 128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================




Wed, 14 Jun 2000 06:34:46 -0400 (EDT)
Vince Vielhaber <vev@michvhf.com>
Re: linking error
There is a small  'C' program.
 Compile successfully and linking error is coming in PQsetdbLogin function.
 This program will run on Linux RH6. How to remove this linking error.
Or
Any other way to connect to backend PostgrsSQL via 'C' program. 
Please waiting your valuable guidance.
Thanx. 
Anuj
 
 
 ******* Compile Result ************
 [rootanuj@Lux2 rootanuj]$ gcc -S conn.c
 [rootanuj@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@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 = "Mydb";
 
       /* 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 */
   }
 
 
 







 There is a small  'C' 
program. Compile successfully and linking error is coming in 
PQsetdbLogin function. This program will run on Linux RH6. How to 
remove this linking error.Or
Any other way to connect to backend 
PostgrsSQL via 'C' program. 
Please waiting your valuable guidance.Thanx. 

Anuj   
******* Compile Result ************ [rootanuj@Lux2 rootanuj]$ gcc -S conn.c [rootanuj@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@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 = 
"Mydb";        /* 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 */   }
Tue, 4 Jul 2000 11:13:59 +0530
"anuj" <Anuj@in-control.de>
linking error