tags:

views:

44

answers:

1

Hi, I'm developing a simple application to use sqlite, the problem is that the following code


/*
...
*/
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("hellogoodbye"); 

if (!db.open()) {
        QMessageBox::critical(0, qApp->tr("Impossibile aprire il database"),
                              qApp->tr("Non è stato possibile aprire il"
                                       "database"), QMessageBox::Cancel);}

give me:


C:\Qt\2010.04\August-build-desktop/../August/main.cc:17: undefined reference to `_imp___ZN12QSqlDatabase17defaultConnectionE' 
C:\Qt\2010.04\August-build-desktop/../August/main.cc:17: undefined reference to `_imp___ZN12QSqlDatabase11addDatabaseERK7QStringS2_' 
C:\Qt\2010.04\August-build-desktop/../August/main.cc:17: undefined reference to `_imp___ZN12QSqlDatabaseD1Ev' 
C:\Qt\2010.04\August-build-desktop/../August/main.cc:18: undefined reference to `_imp___ZN12QSqlDatabase15setDatabaseNameERK7QString' 
C:\Qt\2010.04\August-build-desktop/../August/main.cc:19: undefined reference to `_imp___ZN12QSqlDatabase4openEv' 
C:\Qt\2010.04\August-build-desktop/../August/main.cc:27: undefined reference to `_imp___ZN12QSqlDatabaseD1Ev' 
C:\Qt\2010.04\August-build-desktop/../August/main.cc:27: undefined reference to `_imp___ZN12QSqlDatabaseD1Ev' 

I'm using QTCreator. Anyone can help me?

+2  A: 

Did you add QT += sql to the project file ?

ereOn
No, but now yes and it works.Thank you !
originof