Results 1 to 11 of 11

Thread: SQLite -- obviously missing something...

  1. #1
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default SQLite -- obviously missing something...

    It's probably really obvious to the experts, but I've been working for hours and am worn out from my other job...

    Getting a "symbol(s) not found" and "collect2: Id returned 1 exit status" error when I try to open a SQLite DB...Can I even do what I'm trying to do?



    *.pro file

    #-------------------------------------------------
    #
    # Project created by QtCreator 2011-01-23T12:39:07
    #
    #-------------------------------------------------

    QT += core gui
    QT += sql

    TARGET = STARIS
    TEMPLATE = app


    SOURCES += main.cpp\
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui



    main.cpp

    #include <QtGui/QApplication>
    #include "mainwindow.h"
    #include <sqlite3.h>
    #include <stdlib.h>
    #include <string.h>
    #include <stdio.h>
    #include <syslog.h>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    int rc;
    sqlite3 *db;

    rc=sqlite3_open("/Users/test.db", &db);

    return a.exec();
    }

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: SQLite -- obviously missing something...

    Try adding this to your project file:
    Qt Code:
    1. LIBS += -lsqlite3
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLite -- obviously missing something...

    SWEET!!!! Worked like a charm! No where in any documentation have I seen that -- where can I find such gems?

  4. #4
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: SQLite -- obviously missing something...

    If you haven't already, you might want to read through the qmake manual.

    As for this particular "gem" see here.

  5. #5
    Join Date
    Jan 2010
    Location
    Perth, Australia
    Posts
    37
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: SQLite -- obviously missing something...

    http://doc.qt.nokia.com/latest/qtsql.html

    Edit: Misread the whole thing, sorry. Someone delete this post...
    Last edited by hackerNovitiate; 27th January 2011 at 04:08.

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: SQLite -- obviously missing something...

    Ehm, just to be sure. You want to use the native c++ interface to communicate with the database? Because then you don't need to include sql to your pro file. Otherwise if you only whnt use Qt to access the database see the detailed description to QSqlDatabase.

  7. #7
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLite -- obviously missing something...

    I'm only wanting to use native C++ to connect -- my employer/father-in-law isn't sold on Qt yet despite my arguments and he's wanting to be able to keep the processing separated as much as possible from the GUI...Makes senses, really -- hard to argue against that -- but in some ways it makes life harder for me...

    The "QT += sql" was something that's I'd tried earlier and hadn't removed, but now I have...Thanks!


    scott

    I thought the SQLite library was included/embedded by default and didn't realized it needed added to the .pro file...Guess the documentation confused me a bit...

  8. #8
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: SQLite -- obviously missing something...

    sorry to say but i am little irritated with your personal touch to every post (father in law.) Common its not funny to read as you think. Its an serious technical forum.

  9. #9
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLite -- obviously missing something...

    I am serious, trust me...I have not been a programmer for 22 years without being serious...You don't like my personal touch, don't read my questions...

  10. #10
    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: SQLite -- obviously missing something...

    Quote Originally Posted by scott_hollen View Post
    I thought the SQLite library was included/embedded by default and didn't realized it needed added to the .pro file...Guess the documentation confused me a bit...
    A bundled copy (or system copy if specified) of Sqlite is statically built into the Qt Sqlite driver. Since you are not using this driver this copy of Sqlite is not available to you that way.

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

    scott_hollen (27th January 2011)

  12. #11
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLite -- obviously missing something...

    Thanks for that answer -- makes sense to me now (light bulb just popped on)...I hate having to post questions like these but time is not on my side! The amount of documentation is overwhelming and a bit too detailed in places...


    scott

Similar Threads

  1. DLL missing problem
    By greatfog in forum Newbie
    Replies: 2
    Last Post: 19th January 2011, 06:18
  2. help section missing
    By sattu in forum Newbie
    Replies: 2
    Last Post: 4th January 2011, 12:24
  3. [Qt][SQLite] Two problems with SQLite.
    By Xandareva in forum Newbie
    Replies: 6
    Last Post: 6th April 2010, 23:06
  4. QWT is missing files
    By Jore in forum Newbie
    Replies: 4
    Last Post: 18th February 2010, 15:28
  5. libQtGui_debug.so.4 missing
    By fwohlfert in forum Installation and Deployment
    Replies: 2
    Last Post: 5th October 2006, 19:07

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.