Results 1 to 5 of 5

Thread: QSqlDatabase Link error

  1. #1

    Default QSqlDatabase Link error

    Hi. I'm new to Qt, but have decent experience in C++. I am trying to use QSqlDatabase to connection to MSSQL over an ODBC connection. I've verified I'm linking with QtSqld4.lib and have included QtSql in my app.

    The problem I am having is this:

    Qt Code:
    1. Error 3 error LNK2001: unresolved external symbol "public: static char * QSqlDatabase::defaultConnection" (?defaultConnection@QSqlDatabase@@2PADA) check_db.obj restorer
    2. Error 4 error LNK2001: unresolved external symbol "private: static struct QString::Data QString::shared_null" (?shared_null@QString@@0UData@1@A) check_db.obj restorer
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlDatabase Link error

    did you add QT += sql in you pro-file?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3

    Default Re: QSqlDatabase Link error

    I am using VS2008, so I don't think I have a .pro file (well, I know I DON'T have one now). Should I add one? how is it supposed to be name?

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QSqlDatabase Link error

    well, when you create a new project you should run
    qmake -project
    in the project directory (this commad creates a Qt's project file, i.e. pro-file), then you should add QT += sql to unable SQL support in QT, then run
    qmake -t vcapp
    (this commad create vcproj-file), now you can run your project in VS by calling
    devenv <project_name>.vcproj
    or by double-clicking on <project_name>.vcproj.
    Last edited by spirit; 3rd August 2009 at 17:44. Reason: reformatted to look better
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5

    Default Re: QSqlDatabase Link error

    well, building it using qmake and nmake works, but it's still broken in Visual Studio

Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 14:43
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 13:57
  3. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 03:49
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 13:19
  5. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 25th August 2006, 00:31

Tags for this Thread

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.