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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -