Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt and SQLite -- Build issues

Qt and SQLite -- Build issues

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 4.1k Views
  • 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 Offline
    J Offline
    jtwhite
    wrote on last edited by
    #1

    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
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

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

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

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jtwhite
          wrote on last edited by
          #4

          [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
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved