Qt and SQLite -- Build issues
-
I'm attempting to use SQLite with Qt. This is the code that I have right now:
@#include <QtCore/QCoreApplication>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSQLiteDriver>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("C:\\Users\\Tanner\\Desktop\\db.sqlite"); return a.exec();
}@
I'm using Vista and I installed Qt from the binary on the website.
Here is the output that I receive:
!http://img837.imageshack.us/img837/4951/tempgo.png!
I'm not really sure what I may be doing wrong. Any help is greatly appreciated!
-
Remove
@
#include <QtSql/QSQLiteDriver>
@
and make sure that
@
QT += sql
@
is in your .pro file. -
Why the #include on line 3? What's that for?
-
[quote author="Lukas Geyer" date="1311958856"]Remove
@
#include <QtSql/QSQLiteDriver>
@
and make sure that
@
QT += sql
@
is in your .pro file.[/quote]It builds now! Thank you so much! :D :D