Cant compile using stock RH71 and libpq++ - Mailing list pgsql-general

From bend@ITstuff.net (John Bend)
Subject Cant compile using stock RH71 and libpq++
Date
Msg-id 1d5dfd51.0108181012.13e0ab15@posting.google.com
Whole thread Raw
List pgsql-general
Can anyone please help (before I go insane).

In learning C++, QT and PostgreSQL I have created a very simple
program to connect to my database but I cannot compile it. I really
cannot see what I am doing wrong.

Postgress is running and was fully installed when I installed Redhat
7.1. The libpq++ header is truly in the specified path. I can
successfully compile and connect using C.

Thanks in advance.

John Bend.


Here is the simple program:

#include <iostream>
#include <libpq++.h>


int main()
{

        PgDatabase db("dbname=template1");

        cout << "Program pg1.cpp finished" << endl;

}


I compile it with the line:

g++ pg1.cpp -I/usr/include/pgsql -lpq


And get the following error:

/tmp/ccqlJ23X.o: In function `PgDatabase::PgDatabase(char const *)':
/tmp/ccqlJ23X.o(.PgDatabase::gnu.linkonce.t.(char const *)+0x13):
undefined reference to `PgConnection::PgConnection(char const *)'
/tmp/ccqlJ23X.o: In function `PgDatabase::~PgDatabase(void)':
/tmp/ccqlJ23X.o(.gnu.linkonce.t._._10PgDatabase+0x1d): undefined
reference to `PgConnection::~PgConnection(void)'
/tmp/ccqlJ23X.o: In function `PgDatabase type_info function':
/tmp/ccqlJ23X.o(.gnu.linkonce.t.__tf10PgDatabase+0x10): undefined
reference to `PgConnection type_info function'
/tmp/ccqlJ23X.o(.gnu.linkonce.t.__tf10PgDatabase+0x18): undefined
reference to `PgConnection type_info node'
collect2: ld returned 1 exit status

pgsql-general by date:

Previous
From: "Zuev Dmitry"
Date:
Subject: libpq ::PQstatus()
Next
From: "Jeff Boes"
Date:
Subject: Loading, but not running a query