Results 1 to 7 of 7

Thread: Compiler can't find #include<QSqlDatabase>

  1. #1
    Join Date
    Feb 2006
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Compiler can't find <QSqlDatabase> header file

    hello everybody,

    i'm new to QT and trying to develop a database application.

    i use QT 4.0.1 opensource edition.

    when i try to include <QSqlDatabase> with #include preprocessor, i get an error while compiling.

    The error is :

    QSqlDatabase : No such file or ..

    I don't know what's wrong... i tried to compile my code on WinXP as well as on Linux, but i received the same error.

    Please guide me, I don't have any idea why this is happening.
    Last edited by Arpan; 8th February 2006 at 18:14. Reason: more specific description of problem.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiler can't find #include<QSqlDatabase>

    Add "QT += sql" to your .pro file.

  3. #3
    Join Date
    Feb 2006
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiler can't find #include<QSqlDatabase>

    #include <QtSql/QSqlDatabase>

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiler can't find #include<QSqlDatabase>

    Quote Originally Posted by crocus
    #include <QtSql/QSqlDatabase>
    "#include <QSqlDatabase>" also should work, provided that Qt was configured properly.

  5. #5
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiler can't find #include<QSqlDatabase>

    Quote Originally Posted by jacek
    "#include <QSqlDatabase>" also should work, provided that Qt was configured properly.
    We need buid qt with database suport, and need to know thats some of mysql-driver was built. Sure, if there no sqldrivers (compiled dinamically or statically) it'll not work
    Succes is 5% of talent and 95% of work!

  6. #6
    Join Date
    Feb 2006
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiler can't find #include<QSqlDatabase>

    thanks everybody for ur help..

    i'll reinstall and try to configure QT correctly.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compiler can't find #include<QSqlDatabase>

    Quote Originally Posted by Arpan
    i'll reinstall and try to configure QT correctly.
    Start from adding "QT += sql" to your .pro file, as it takes less time to check (not mentioning that Qt is probably already configured correctly).

Similar Threads

  1. The compiler error:"cannot find -lQtGuid4"
    By osmanthus in forum Installation and Deployment
    Replies: 1
    Last Post: 7th January 2009, 06:58
  2. problems installing Qt opensource with msvc2008 support
    By odin1985 in forum Installation and Deployment
    Replies: 6
    Last Post: 24th May 2008, 09:06
  3. imageformats plugins
    By ht1 in forum Installation and Deployment
    Replies: 23
    Last Post: 10th January 2008, 19:18
  4. GCC can't find QSqlDatabase!!
    By brevleq in forum Qt Programming
    Replies: 5
    Last Post: 29th October 2007, 07:05
  5. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.