linking with C++ libraries
raphael Bauduin
raph at innocent.com
Fri Jul 7 22:52:31 BST 2000
Hi!
I'm not a specialist of C++ and inacuracies may occur in my
descriptions :-)
I want to develop a C++ application that will interact with a postgres
database, so I have to use the libpq++. Here
is what I do:
I create a new C++ project and paste the following code
from the postgresql tests:
----------begin-----------------------------
PgDatabase data("dbname=template1");
if ( data.ConnectionBad() ) {
cout << "Connection was unsuccessful..." << endl
<< "Error message returned: " << data.ErrorMessage() <<
endl;
return 1;
}
else
cout << "Connection successful...
-----------end------------------------------
when I compile the file obtained with
g++ test.cpp -I/usr/include/pgsql \
-I/usr/include/pgsql/libpq++ -lpq -lpq++
I get no problem.....
Now, in kdevelop, I want to specify the compile options,
so I press F7, take the "compile options" and paste
the following:
-I/usr/include/pgsql -I/usr/include/pgsql/libpq++ -lpq
-lpq++
but when I press OK, I get the following error:
--------------begin-----------------------------
checking for gcc... (cached) gcc
checking whether the C compiler (gcc -O0 -g3 -Wall
-I/usr/include/pgsql -I/usr/include/pgsql/libpq++ -lpq
-lpq++ ) works... no
configure: error: installation or configuration problem:
C compiler cannot create executables.
*** failed ***
----------------end-----------------------------
If I don't specify -lpq++, it doesn't work either (some missing
references, to the libpq++...)
The problems seems to come from the -lpq++ and I think
it is because it tests gcc and not g++..... Is this the
right explanation? And how do I fix this?
Thanks very much for your help!
Raph
--
----------------------------------
| -°) (°- |
| /\\ Linux for ever //\ |
| _\_v v_/_ |
----------------------------------
If windows is the answer, it must have been a stupid question.
More information about the KDevelop
mailing list