QSqlDatabase LNK2019 error -
i tried compile 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 received 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 .pro what's problem?
you should add qtsql.lib
( can find name of qtsql in qt/lib in computer) go project/properties/configuration properties/linker/input, add qtsql.lib
additional dependencies
p.s. used face error, , error fixed way. luck
Comments
Post a Comment