Results 1 to 3 of 3

Thread: Setting Default directory for libraries in Qt Creator

  1. #1
    Join Date
    Jul 2011
    Location
    On Earth
    Posts
    10
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Setting Default directory for libraries in Qt Creator

    Hi,

    When I run my application which accesses MySQL database using Qt Creator, I get the "QSqlDatabase: QMYSQL driver not loaded" error. But when I compile and run it on the terminal (I am using Ubuntu 11.04), it works fine.
    When I checked the two makefiles (one generated by Qt Creator & the other by qmake on the terminal), there are differences in the directories for LIBS and INCPATH as shown below:

    Makefile by Qt Creator
    ...
    INCPATH = -I/opt/QtSDK/Desktop/Qt/473/gcc/mkspecs/linux-g++ -I../MyProject -I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtCore -I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtGui -I/opt/QtSDK/Desktop/Qt/473/gcc/include/QtSql -I/opt/QtSDK/Desktop/Qt/473/gcc/include -I../MyPoject -I. -I.
    LIBS = $(SUBLIBS) -L/opt/QtSDK/Desktop/Qt/473/gcc/lib -lQtSql -lQtGui -lQtCore -lpthread
    ...

    Makefile by terminal
    INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I. -I.
    LIBS = $(SUBLIBS) -L/usr/lib -lQtSql -lQtGui -lQtCore -lpthread


    So my question is how can I make Qt creator to generate the same makefile as the one generated from the terminal, i.e make Qt Creator to "see" the MySQL libraries directory which is /usr/lib/qt4/plugins/sqldrivers?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,593
    Thanks
    13
    Thanked 1,587 Times in 1,516 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Setting Default directory for libraries in Qt Creator

    Create a build configuration (under Projects) that uses "Qt in PATH" rather than the specific version you have it using now. You can adjust the available Qt versions from the Options dialog.

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

    manaila (2nd March 2012)

  4. #3
    Join Date
    Jul 2011
    Location
    On Earth
    Posts
    10
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Setting Default directory for libraries in Qt Creator

    It worked, thank you!

Similar Threads

  1. File Dialog Default Directory Not Right
    By cpsmusic in forum Newbie
    Replies: 0
    Last Post: 27th October 2011, 13:09
  2. Changing default directory of output files
    By bigbill in forum Newbie
    Replies: 1
    Last Post: 6th December 2010, 00:18
  3. Setting a widget's QPalette to default?
    By Spectralist in forum Newbie
    Replies: 2
    Last Post: 29th December 2009, 21:47
  4. Default Project Directory
    By MIH1406 in forum Newbie
    Replies: 8
    Last Post: 8th September 2009, 08:35
  5. Hot to define the directory for the dynamic libraries?
    By Dark_Tower in forum Qt Programming
    Replies: 5
    Last Post: 28th December 2006, 22: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.