Results 1 to 7 of 7

Thread: sqlite3 with QT

  1. #1
    Join Date
    Apr 2012
    Posts
    49
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default sqlite3 with QT

    Hi all,

    I have a small doubt.

    I am trying to implement sqlite3 read operation in QT.The other daemon which is implemented in c will write in to database.In QT i need to read the database and show in appropriate table widget.When i trying to port read operation into QT it gives an error undefined reference to sqlite3_open_v2.

    I am using same header for implementing QT.


    Could anyone help me out to sort this problem. and i would like to know that whether i am going in a right path?

    Thanks in advance.

    Regards
    Vinithr

  2. #2
    Join Date
    Apr 2012
    Posts
    49
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: sqlite3 with QT

    Hi,
    I am halfway through this problem. In this i need to link a library named libsqlite3.so to Qt application. this library is located in /usr/lib/

    Normally we use to link library in C/C++ using the command gcc sample.c -l /usr/lib/libsqlite3.so

    I have a small query,how can i link this library in QT ?

    Thanks in advance.

    Regards.
    Vinithr

  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: sqlite3 with QT

    The solution does not depend on your use of Qt. It depends on which build system you use. If you use qmake, then you will need the LIBS variable.

  4. The following user says thank you to yeye_olive for this useful post:

    vinithr (6th August 2012)

  5. #4
    Join Date
    Apr 2012
    Posts
    49
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: sqlite3 with QT

    Hi,

    Thanks for your reply. I am using qmake only.so i can add LIBS variable in .pro file right.?

  6. #5
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: sqlite3 with QT

    Yes, all you have to do is add a suitable line LIBS += ... to the .pro file. Refer to the link in my previous post -- and more generally to qmake's documentation -- for details. I suspect that LIBS += -lsqlite3 will be enough since the library seems to be located in a standard location on your system.

  7. The following user says thank you to yeye_olive for this useful post:

    vinithr (5th August 2012)

  8. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: sqlite3 with QT

    As usual it is in the docs: Declaring Other Libraries

    Is there a reason you cannot use the Qt SQL support to achieve what you want?

  9. The following user says thank you to ChrisW67 for this useful post:

    vinithr (6th August 2012)

  10. #7
    Join Date
    Apr 2012
    Posts
    49
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: sqlite3 with QT

    Thanks for your reply. I could be able to compile the code.Some customization are going on. I will get back to you,if i am getting any error.

    Thanks
    Vinithr

Similar Threads

  1. Qt embedded compiling with Sqlite3
    By cooper in forum Newbie
    Replies: 5
    Last Post: 18th February 2015, 10:21
  2. Advice using sqlite3 with threading
    By enricong in forum Qt Programming
    Replies: 1
    Last Post: 22nd December 2010, 21:29
  3. SQLite3 and Qt
    By k12yp70n in forum Newbie
    Replies: 3
    Last Post: 18th March 2009, 15:18
  4. Sqlite3 window problem
    By giusepped in forum Qt Programming
    Replies: 11
    Last Post: 7th November 2008, 02:18
  5. problem: inserting a BLOB into sqlite3 with QT4.3
    By oscar in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2007, 12:38

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.