PQsetdb
Dears,I have added following constructor to my class:
class CPgsql : public CCore
{
public:
char *pghost,
*pgport,
*pgoptions,
*pgtty;
char *dbName;
PGconn *connection2db;
const char * conninfo;
CPgsql(const char *dbname);
};
CPgsql::CPgsql(const char *dbname)
{
pghost=NULL;
pgport=NULL;
pgoptions=NULL;
pgtty=NULL;
dbName=(char*)dbname;
connection2db=PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
}//end of constructor
But when i call it ,for example :
CPgsql p("x");
I recieve following error:
[root@localhost sql2sql]# make
g++ -c -I/usr/include/mysql -I/usr/include sql2sql.cpp;
g++ -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -o
sql2sql sql2sql.o ;
sql2sql.o(.text+0x6c): In function `CPgsql::CPgsql[not-in-charge](char
const*)':
: undefined reference to `PQsetdbLogin'
sql2sql.o(.text+0x10e): In function `CPgsql::CPgsql[in-charge](char const*)':
: undefined reference to `PQsetdbLogin'
collect2: ld returned 1 exit status
make: *** [sql2sql] Error 1
Please help me..................................
Mohsen Pahlevanzadeh wrote:
I recieve following error:
[root@localhost sql2sql]# make
g++ -c -I/usr/include/mysql -I/usr/include sql2sql.cpp;
^^^^^^
g++ -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -o
^^^^^ ^^^^^^^^^^^
Those aren't going to help, are they?
--
Richard Huxton
Archonet Ltd
My program is using both MySQL & PostgreSQL.I don't have problem with
Mysql.But i have problem with pgsql.
Show quoted text
Mohsen Pahlevanzadeh wrote:
I recieve following error:
[root@localhost sql2sql]# make
g++ -c -I/usr/include/mysql -I/usr/include sql2sql.cpp;^^^^^^
g++ -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -o
^^^^^ ^^^^^^^^^^^
Those aren't going to help, are they?--
Richard Huxton
Archonet Ltd
On Wed, 23 Feb 2005, Mohsen Pahlevanzadeh wrote:
My program is using both MySQL & PostgreSQL.I don't have problem with
Mysql.But i have problem with pgsql.
That could be because you don't appear to be linking to the PostgreSQL
libraries (as Richard was hinting at).
Show quoted text
Mohsen Pahlevanzadeh wrote:
I recieve following error:
[root@localhost sql2sql]# make
g++ -c -I/usr/include/mysql -I/usr/include sql2sql.cpp;^^^^^^
g++ -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -o
^^^^^ ^^^^^^^^^^^
Those aren't going to help, are they?--
Richard Huxton
Archonet Ltd---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
Mohsen Pahlevanzadeh wrote:
My program is using both MySQL & PostgreSQL.I don't have problem with
Mysql. But i have problem with pgsql.
I think Richard's point is that you are not linking in any PostgreSQL
libs.
Mohsen Pahlevanzadeh wrote:
I recieve following error:
[root@localhost sql2sql]# make
g++ -c -I/usr/include/mysql -I/usr/include sql2sql.cpp;^^^^^^
g++ -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib
g++ -o^^^^^ ^^^^^^^^^^^
Those aren't going to help, are they?--
Richard Huxton
Archonet Ltd
--
Guy Rouillier
Import Notes
Resolved by subject fallback
If you see my orginal email,I mentioned to link to inc & lib for
pgsql.Even when i use PQsetdb,I didn't recieve error message for using
PQsetdb.
Yours,Mohsen
Show quoted text
On Wed, 23 Feb 2005, Mohsen Pahlevanzadeh wrote:
My program is using both MySQL & PostgreSQL.I don't have problem with
Mysql.But i have problem with pgsql.That could be because you don't appear to be linking to the PostgreSQL
libraries (as Richard was hinting at).Mohsen Pahlevanzadeh wrote:
I recieve following error:
[root@localhost sql2sql]# make
g++ -c -I/usr/include/mysql -I/usr/include sql2sql.cpp;^^^^^^
g++ -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib
-o
^^^^^ ^^^^^^^^^^^
Those aren't going to help, are they?--
Richard Huxton
Archonet Ltd---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
sszabo@bigpanda.com
On Wed, 23 Feb 2005, Mohsen Pahlevanzadeh wrote:
If you see my orginal email,I mentioned to link to inc & lib for
pgsql.Even when i use PQsetdb,I didn't recieve error message for using
PQsetdb.
The fragment of execution of make you gave had no mention of them in the
commandlines shown. What does your Makefile look like?
My Makefile is :
mysql_INCS=-I/usr/include/mysql
pgsql_INCS=-I/usr/include
pgsql_LIBS=-L/usr/lib
mysql_LIBS=-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm
CXX=g++
sql2sql : sql2sql.o
$(CXX) $(mysql_LIBS) $(pgsql_LIBS) -o sql2sql sql2sql.o ;
rm -rf sql2sql.o ;
sql2sql.o : sql2sql.cpp
$(CXX) -c $(mysql_INCS) $(pgsql_INCS) sql2sql.cpp;
clean :
rm -rf sql2sql.o
rm -rf sql2sql
~
Show quoted text
sszabo@bigpanda.com
On Wed, 23 Feb 2005, Mohsen Pahlevanzadeh wrote:
If you see my orginal email,I mentioned to link to inc & lib for
pgsql.Even when i use PQsetdb,I didn't recieve error message for using
PQsetdb.The fragment of execution of make you gave had no mention of them in the
commandlines shown. What does your Makefile look like?