For some reason I'm getting linker errors when I try to add sqlite db to my qt project.
qt_sqlite_linker_error.jpg
#include <QApplication>
#include <QtSql/QSqlDatabase>
int main(int argc, char *argv[])
{
db.setDatabaseName("C:/path/to/my/sqlite/file/file.sqlite");
db.open();
db.close();
MainWindow w;
w.show();
return a.exec();
}
#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();
}
To copy to clipboard, switch view to plain text mode
I also have
QT += sql
QT += sql
To copy to clipboard, switch view to plain text mode
in my .pro file.
Any suggestions?
Bookmarks