Results 1 to 8 of 8

Thread: SQLITE undefined reference

  1. #1
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Angry SQLITE undefined reference

    Hello,

    Having downloaded QT 4.3.1 binaries, sqlite support seems to be natively supported but when I compile my software (which was working with previous build of Qt, but from the sources of Qt, not the binaries...) I now get the message:

    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    oc -Wl,-s -mthreads -Wl -o "release\dopcica.exe" object_script.dopcica.Release
    -L"c:\Qt\4.3.1\lib" -lmingw32 -lqtmain -LC:/Qt/4.3.1/plugins/sqldrivers/ -lqsql
    ite4 -lQtGui4 -lQtCore4
    ./release\Consultation.o(.text+0x436):Consultation.c pp: undefined reference to `
    _imp___ZN12QSqlDatabaseC1ERKS_'
    (...)

    Why the symbol _imp___ZN12QSqlDatabaseC1ERKS_ is incorrect???
    However, I link qsqlite4 which should resolve that symbol...

    Initially, I've added the following to my project file:
    QTPLUGIN += qsqlite

    Any idea?

    Thank you for your help.
    Best regards,
    Oscar

  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: SQLITE undefined reference

    You're not linking your application with QtSql module. Add QT += sql to your .pro file.

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: SQLITE undefined reference

    Only core and gui modules are enabled by default. Try adding
    QT += sql
    to the .pro file.
    J-P Nurmi

  4. #4
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Default Re: SQLITE undefined reference

    Thank you for this quick reply!
    the compilation is in progress... the answer in a few minutes...

  5. #5
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Angry Re: SQLITE undefined reference

    Well, it's better but still don't work.

    Now, the driver doesn't load.

    When I list the available databases, I get:
    QSQLITE
    QODBC3
    QODBC

    But when I try to open a database file, I get:
    error on openingriver not loaded Driver not loaded

    How can i load the driver...?

    Thanks in advance.
    Best regards,
    Oscar

  6. #6
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Default Re: SQLITE undefined reference

    Oups, it's ok now!

  7. #7
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Smile Re: SQLITE undefined reference

    I was adding:
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLite")

    instead of:
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE")

    Now, everything compiles ok and I manage to open the database file.

    Thank you very much jpn and jacek for your help.
    Best regards,
    Oscar

  8. #8
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Default Re: SQLITE undefined reference

    In a "perfect world", it would be nice that the command:
    qmake -project

    detects that some of my files include sql and try to open QSQLITE and consequently add automatically the lines:
    QTPLUGIN += qsqlite
    QT += sql

    to the .pro file...
    Maybe in the next release of Qt...

Similar Threads

  1. Replies: 5
    Last Post: 7th November 2007, 14:46
  2. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  3. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  4. Strange error while using Q3Canvas
    By Kapil in forum Newbie
    Replies: 13
    Last Post: 15th June 2006, 19:36
  5. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

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
  •  
Qt is a trademark of The Qt Company.