pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feed7.2.1 failure to complie C programs
2+ messages / 2 participants
[nested] [flat]
* 7.2.1 failure to complie C programs
@ 2002-09-02 03:37 Rex Recio <rexrecio@yahoo.com>
0 siblings, 1 reply; 2+ messages in thread
From: rexrecio@yahoo.com @ 2002-09-02 03:37 UTC (permalink / raw)
To: pgsql-interfaces
I have been trying to compile my first C program on PostgreSQL 7.1.2.
Here is my source code:
/*filename is hello.c*/
#include <stdio.h>
#include "libpq-fe.h"
int main (int argc, char *argv[])
{
PGConn *masterConn;
printf("Hello World!\n");
masterConn = PQconnectdb("hostaddr=192.168.0.23 dbname=masterdb
user=postgres
password=postgres");
return 1;
}
I tried compliling it using gcc -c hello.c but it gives me the
following error:
hello.c: In function `main':
hello.c:6: `PGConn' undeclared (first use in this function)
hello.c:6: (Each undeclared identifier is reported only once
hello.c:6: for each function it appears in.)
hello.c:6: `masterConn' undeclared (first use in this function)
The include file for POstgreSQL is already located at the
/usr/include. Nevertheless I also tried specifying it in the
complier. I tried compiling using:
gcc -c hello.c -I/usr/include
gcc -c hello.c -I/usr/include/pgsql
I got the same error.
I'm using RedHat 7.3 and the default Postgres installation that comes
with it, 7.2.1. I noticed that there is an 'undeclared error' for
PGConn but not for 'PQConnectdb'. I examnined the header file and
true enough there is no declaration for PGConn.
Is there anybody out there who had the same experience and was able to
fix it? Please help.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: 7.2.1 failure to complie C programs
@ 2002-09-03 14:24 Tom Lane <tgl@sss.pgh.pa.us>
parent: Rex Recio <rexrecio@yahoo.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2002-09-03 14:24 UTC (permalink / raw)
To: rexrecio@yahoo.com; +Cc: pgsql-interfaces
rexrecio@yahoo.com (Rex Recio) writes:
> I have been trying to compile my first C program on PostgreSQL 7.1.2.
> Here is my source code:
> PGConn *masterConn;
s/PGConn/PGconn/
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-09-03 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-02 03:37 7.2.1 failure to complie C programs Rex Recio <rexrecio@yahoo.com>
2002-09-03 14:24 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox