From: | bend(at)ITstuff(dot)net (John Bend) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Cant compile using stock RH71 and libpq++ |
Date: | 2001-08-19 16:05:05 |
Message-ID: | 1d5dfd51.0108190805.481d5b41@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Solved it.
My compile line was incorrect. I now use:
g++ {sourcfile} -o {runfile} \
-I/usr/include/pgsql \
-L/usr/include/pgsql/lib
-lpq++
(Where \ are line continuation characters.)
John Bend.
bend(at)ITstuff(dot)net (John Bend) wrote in message news:<1d5dfd51(dot)0108181012(dot)13e0ab15(at)posting(dot)google(dot)com>...
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | newsreader | 2001-08-19 17:49:00 | is this possible? it should be! |
Previous Message | John Bend | 2001-08-19 16:01:13 | Re: testlibpq.c compilation |