I tried to compile the following code in Qt 5.0.0:
#include <QApplication>
#include <QtSql/QSql>
#include <Qtsql/QSqlDatabase>
#include <QStringList>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QStringList db = QSqlDatabase::drivers();
return a.exec();
}
and I received this error:
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QStringList __cdecl QSqlDatabase::drivers(void)" (__imp_?drivers@QSqlDatabase@@SA?AVQStringList@@XZ) referenced in function _main
debug\test.exe:-1: error: LNK1120: 1 unresolved externals
I have added QT += sql
in my .pro
. What's the problem?