Not able to execute in Release Mode
Hello ,
I have a small problem with Qt. I am not able to run a simple database program in Relese mode but it works in Debug mode. I have some other widgets which work only in release mode so i have to make it work in release mode itself. I am using Qt integrated with VS .Net (2003). When i run it in release mode it throws an error which is given in Sqlite db connection.h file that (connection is not established). But it works fine in Debug mode i don't get any error. Pls help me out with this problem .
Thank You
Re: Not able to execute in Release Mode
Check for variable initializations and memory handling.
Usually in debug mode, variables are intialised with default value, but in release it will give garbage. Most common mistake I have encountered :D
Re: Not able to execute in Release Mode
Hey i checked all the linker paths Include paths every thing is in the right path but still i get the same problem. In debug mode even the database file is created but in release mode after the build is done there is no error exactly but the database file is not created. This is the connection.h code
Code:
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QtGui/QMainWindow>
#include <QtSql>
#include <QMessageBox>
#include <QTableView>
inline bool createConnection()
{
db.setDatabaseName(" LPSC");
if (!db.open())
{
QMessageBox::critical(0, qApp
->tr
("Cannot open database"),
qApp->tr("Unable to establish a database connection.\n"
"This example needs SQLite support. Please read "
"the Qt SQL driver documentation for information how "
"to build it.\n\n"
return false;
}
}
#endif
I even get this warning when i run it on release mode
Code:
warning C4715: 'createConnection' : not all control paths return a value
Pls tell me if i am missing some thing or going any where wrong.
Thank You
Re: Not able to execute in Release Mode
rewrite this function like this
Code:
inline bool createConnection()
{
db.setDatabaseName(" LPSC");
if (!db.open())
{
QMessageBox::critical(0, qApp
->tr
("Cannot open database"),
qApp->tr("Unable to establish a database connection.\n"
"This example needs SQLite support. Please read "
"the Qt SQL driver documentation for information how "
"to build it.\n\n"
return false;
}
return true;
}