Hi everyone, I'm new on Qt, so maybe my problem is not that big, but I've searched a bit and didn't found a solution yet.
I've written an application using Qt under Linux environment, everything worked well. Then I've compiled it under xp and still everything worked well. Now I want to distribute it on computer that has not Qt installed, so I copied the exe compiled under xp, and with it I copied the dll needed (qtsql4, qtgui4, qtcore4, mingwm10) and when I run the application the "Unable to establish a database connection. This example needs SQLite support. Please read the Qt SQL driver documentation for information how to build it. Click Cancel to exit." message that is in a "connection.h" file that I show below. I really don't know how to go on...
#include <QTimer>
#include <QtSql>
#include <QMessageBox>
static bool createConnection()
{
// db.setDatabaseName(":memory:");
db.setDatabaseName("yorkshire_db");
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;
}
#include <QTimer>
#include <QtSql>
#include <QMessageBox>
static bool createConnection()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
// db.setDatabaseName(":memory:");
db.setDatabaseName("yorkshire_db");
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"
"Click Cancel to exit."), QMessageBox::Cancel);
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks