Important: Please read the Qt Code of Conduct -

[solved]SQLite database in Qt visual studio add-in

  • How can I make SQLite working in VS? In Qt Creator I added QT += sql into a .pro file, but there is no such file in VS.
    And, probably, because of this, when I add all necessary libraries and write "QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");db.setDatabaseName("logs_database");" there are dozen errors, something like 'unresolved external symbol referenced in function main'. And one more thing. In VS i can't add just <QtSql>, I have to add all libraries which contains in this folder, like #include <QtSql\qsql.h>, #include <QtSql\qsqlquery.h>, #include <QtSql\qsqldatabase.h> bla bla bla.......Is there any way to add only one folder, or maby file?

  • Lifetime Qt Champion


    You can generate a Visual Studio project from you pro file and have everything setup for you. There's also the Qt VisualStudio AddIn that you could use.

    Hope it helps

  • @SGaist
    I exactly use Qt VisualStudio AddIn, and I have a project, in which I need to add a database and I don't know how I can do this. If I understood you correctly, if I generate a Visual Studio project from pro file, it will be a new empty project, but I don't want to copy all my code into new project)) Maybe there is a way just to add some settings?

  • @SGaist
    I no longer need an answer, I decided to move my project to qt creator so I don't have any problems anymore=)

Log in to reply