Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DF1CE4769AF for ; Mon, 27 Jan 2003 18:04:34 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 7DF3C4761ED for ; Mon, 27 Jan 2003 18:04:03 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 6419443B09A; Mon, 27 Jan 2003 18:04:03 -0500 (EST) From: "David Wright" Subject: Difficulty getting started with Postgres C++ interface Date: Mon, 27 Jan 2003 17:42:11 -0500 X-Newsgroups: comp.databases.postgresql.interfaces Message-ID: User-Agent: Pan/0.10.0 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Comment-To: ALL Lines: 80 X-Complaints-To: abuse@mergetel.com X-DMCA-Complaints-To: abuse@mergetel.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 To: pgsql-interfaces@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/116 X-Sequence-Number: 3616 Hi there, I have been successfully using the perl DBI interface for some time and have just begun a new project which needs to be written in C++. My problem is that I am unable to compile even a simple C++ program without error. I am running a Mandrake 8.1 distribution of Linux, Postgres version 7.1.2 (with the libpq++ stuff that came with it) and trying to compile with g++. my program is: #include #include "libpq++.h" int main() { // Open the connection to the database and make sure it is OK const char* dbName="dbname=dwright"; PgDatabase data("dbName"); /* if ( data.ConnectionBad() ) { cout << "Connection was unsuccessful..." << endl; cout << "Error message returned: " << data.ErrorMessage() << endl; return 1; } else cout << "Connection successful... Enter queries below:" << endl; // Interactively obtain and execute queries ExecStatusType status; string buf; int done = 0; while (!done) { cout << "> "; cout.flush(); getline(cin, buf); if ( buf != "" ) if ( (status = data.Exec( buf.c_str() )) == PGRES_TUPLES_OK ) data.DisplayTuples(); else cout << "No tuples returned..." << endl << "status = " << status << endl << "Error returned: " << data.ErrorMessage() << endl; else done = 1; } */ return 0; } // End main() Note that I have commented out everything except the connect!! my command line is: g++ -I/usr/include/pgsql myc.cpp -o myc and the error messages are: /home/dwright/tmp/ccx7SvXE.o: In function `PgDatabase::PgDatabase(char const *)': /home/dwright/tmp/ccx7SvXE.o(.PgDatabase::gnu.linkonce.t.(char const *)+0x13): undefined reference to `PgConnection::PgConnection(char const *)' /home/dwright/tmp/ccx7SvXE.o: In function `PgDatabase::~PgDatabase(void)': /home/dwright/tmp/ccx7SvXE.o(.gnu.linkonce.t._._10PgDatabase+0x1d): undefined reference to `PgConnection::~PgConnection(void)' /home/dwright/tmp/ccx7SvXE.o: In function `PgDatabase type_info function': /home/dwright/tmp/ccx7SvXE.o(.gnu.linkonce.t.__tf10PgDatabase+0x10): undefined reference to `PgConnection type_info function' /home/dwright/tmp/ccx7SvXE.o(.gnu.linkonce.t.__tf10PgDatabase+0x18): undefined reference to `PgConnection type_info node' collect2: ld returned 1 exit status Any assistance will be greatly appreciated. Regards, David -- David Wright 912 - 614 Lake Street St. Catharines, ON L2N 6P6 Web Site: