Thread: troubles with C

troubles with C

From
Mario Molfese
Date:

Hi folks,

 

I’ve a Debian Linux Machine on which are installed

 

odbc-postgresq 7.2.1-2woody2

postgresql     7.2.1-2woody2

postgresql-dev 7.2.1-2woody2

 

on this machine i cannot compile this C source code

 

#include <stdio.h>

#include <postgresql/libpq-fe.h>

 

int main() {

        char            *PQhost, *PQport, *PQoptions, *PQtty, *PQDBname;

        PGconn          *CN;

        PGresult        *RS;

 

        PQhost = NULL;

        PQport = NULL;

        PQoptions = NULL;

        PQtty = NULL;

        PQDBname = "testdb";

 

        CN = PQsetdb(PQhost, PQport, PQoptions, PQtty, PQDBname);

 

        printf("%d\n", PQstatus(CN));

        return 1;

};

 

gcc says to me

 

/tmp/ccYjFLoB.o: In function `main':

/tmp/ccYjFLoB.o(.text+0x45): undefined reference to `PQsetdbLogin'

/tmp/ccYjFLoB.o(.text+0x5c): undefined reference to `PQstatus'

collect2: ld returned 1 exit status

 

it seems like it is not able to recognize the postgresql functions called by PQsetdb, but this make no sense. or no ?

 

please someone help me !

 

thanks in advance

 

Mario


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.480 / Virus Database: 276 - Release Date: 12/05/2003