Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt and SQLite -- Build issues

    General and Desktop
    3
    4
    3829
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jtwhite last edited by

      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(&#41;;
      

      }@

      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!

      1 Reply Last reply Reply Quote 0
      • L
        lgeyer last edited by

        Remove
        @
        #include <QtSql/QSQLiteDriver>
        @
        and make sure that
        @
        QT += sql
        @
        is in your .pro file.

        1 Reply Last reply Reply Quote 0
        • D
          dangelog last edited by

          Why the #include on line 3? What's that for?

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply Reply Quote 0
          • J
            jtwhite last edited by

            [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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post