Skip to content Skip to sidebar Skip to footer

Error: Invalid Conversion From ‘int (*)(std::list, Int, Char**, Char**)’ To ‘int (*)(void*, Int, Char**, Char**)’

I will try to be as succinct as possible. Well, I am given a project whose AIM is Access Sqlite3 Database by using C++. Make a class having member functions for executing differen

Solution 1:

You're trying to pass a function pointer to the sqlite3_exec function of the wrong type. You need to change your callback's signature back to the way you had it.

staticintcallback(void *param, int argc, char **argv, char **azColName)

Then you should call sqlite3_exec appropriately. Something like this:

rc = sqlite3_exec(db, "SELECT * FROM emp_info WHERE AGE>40; ", callback, &employee_info2, &zErrMsg);

Finally, inside your callback you cast param back to the correct type.

std::list<Employee*>& employee_info2 = std::reinterpret_cast<std::list<Employee*>&>(*param);

Post a Comment for "Error: Invalid Conversion From ‘int (*)(std::list, Int, Char**, Char**)’ To ‘int (*)(void*, Int, Char**, Char**)’"