X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 73A7CD1CB08 for ; Sat, 22 Nov 2003 16:14:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 66980-09 for ; Sat, 22 Nov 2003 12:14:12 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id C1441D1D85D for ; Sat, 22 Nov 2003 12:14:11 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id BA64E354F5; Sat, 22 Nov 2003 08:14:05 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id B8F4E354E9; Sat, 22 Nov 2003 08:14:05 -0800 (PST) Date: Sat, 22 Nov 2003 08:14:05 -0800 (PST) From: Stephan Szabo To: Ashok Chauhan Cc: pgsql-admin Subject: Re: ERROR In-Reply-To: <1069508871.1222.25.camel@chi> Message-ID: <20031122080919.V14063@megazone.bigpanda.com> References: <1069508871.1222.25.camel@chi> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/384 X-Sequence-Number: 11371 On Sat, 22 Nov 2003, Ashok Chauhan wrote: > > # include > # include > int main() > { > int feild; > PGresult *result; > PGconn *conn; > conn = PQconnectdb("database"); > result = PQexec (conn, "select * from teblename"); > feild = PQntuples (result); > printf("%d",feild); > PQclear(result); > PQfinish (conn); > return (1); > > } > > I RUN THE ABOVE PROGRAM BUT IT GIVE SOME ERRORS THAT ARE FOLLOWS:- Are you sure you're running the program when you get these errors as opposed to compiling/linking? The below look like linking errors you'd get if you forgot to specify that you want to link with libpq. If you're using gcc, you probably want at least -lpq and possibly a -L on the commandline. > > /tmp/ccApFcdl.o: In function `main': > /tmp/ccApFcdl.o(.text+0x19): undefined reference to `PQconnectdb' > /tmp/ccApFcdl.o(.text+0x2f): undefined reference to `PQexec' > /tmp/ccApFcdl.o(.text+0x40): undefined reference to `PQntuples' > /tmp/ccApFcdl.o(.text+0x64): undefined reference to `PQclear' > /tmp/ccApFcdl.o(.text+0x72): undefined reference to `PQfinish' > collect2: ld returned 1 exit status > > HELP ME > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >