mardi 4 août 2015

Invalid conversion from void * when using ibpp in c++

One of my class members has void * type:

void * conn;

In Connection method I set connection to Firebird database and set conn member like this:

IBPP::Database conn = IBPP::DatabaseFactory(host, dbname, user, pass);
conn->Connect();
this->conn = static_cast<void *>(conn);

This way of doing things works well for other multiple databases, but breaks when I try to use it with Firebird. So, this is what happens. In another method I use conn member to fetch data from a particular database. When it comes to Firebird, I do it like this:

IBPP::Transaction tr = IBPP::TransactionFactory(static_cast<IBPP::Database>(this->conn));

However, this line of code results in an error message:

error: invalid conversion from 'void *' to 'IBPP::IDatabase *'

I do not know what I'm doing wrong.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire