PDA

View Full Version : qtsqlite build problem



cdarwin
20th June 2013, 12:32
For some reason I'm getting linker errors when I try to add sqlite db to my qt project.

9170



#include <QApplication>
#include <QtSql/QSqlDatabase>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("C:/path/to/my/sqlite/file/file.sqlite");
db.open();
db.close();
MainWindow w;
w.show();
return a.exec();
}


I also have


QT += sql

in my .pro file.

Any suggestions?

cdarwin
20th June 2013, 16:08
Problem solved. I disabled QML debugging in project menu.

ChrisW67
20th June 2013, 22:00
Any suggestions?
Yes, the debugging option has nothing to do with this.

You must rerun qmake after you modify the PRO file... this was your likely problem.
You do not need "QtSql/" in line 2 if you have "QT += sql" in the PRO file.