Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to install MySql driver plugin in QT SDK 4.7 (2010.05)?
Forum Updated to NodeBB v4.3 + New Features

How to install MySql driver plugin in QT SDK 4.7 (2010.05)?

Scheduled Pinned Locked Moved Installation and Deployment
17 Posts 7 Posters 22.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blex
    wrote on last edited by
    #4

    At the step 7 try to run make from the mysql plugin sources dir


    Oleksiy Balabay

    1 Reply Last reply
    0
    • B Offline
      B Offline
      blueyes
      wrote on last edited by
      #5

      Blex,

      Can I have an explanation for your request?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blex
        wrote on last edited by
        #6

        I do not compile mysql driver myself but I guess that the following may help:

        After running step 6 you will get Makefile in the %QTDIR%\src\plugins\sqldrivers\mysql\ directory

        Go to this directory and try to execute "make", or "mingw32-make"

        Your build fails on the step not related to mysql compilation.


        Oleksiy Balabay

        1 Reply Last reply
        0
        • B Offline
          B Offline
          blueyes
          wrote on last edited by
          #7

          I understand your point but If the original binaries coming along with SDK have been compiled using a different version of mingw or a different configuration, this probably won't work.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            blex
            wrote on last edited by
            #8

            Just for clarification: I suppose that you do all steps 1-7 from your instruction above with changes in according to my post.

            mingw used for SDK build is not important to you, only Qt. Try to recompile Qt from sources. On modern PC it takes not more than 2 hours. You can pass to configure.exe the switches to include mysql plugin.

            Probably, it is better to download qt sources separately and build them in other directory. After that just tell QtCreator what Qt version should be used.


            Oleksiy Balabay

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blueyes
              wrote on last edited by
              #9

              OK, blex. I'll try your idea first and if it doesn't fix the problem I will try downloading qt sources separately and build them. I will let you know the result.

              Only another question: how can I tell QtCreator what Qt version should be used?

              Thanks a lot for your time.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                blex
                wrote on last edited by
                #10

                [quote author="blueyes" date="1291357867"]Only another question: how can I tell QtCreator what Qt version should be used?[/quote]

                Anfortunately, I have localized UI on my PC, so, maybe English menus are slightly different: use Tools - Options - Qt4 - Qt versions


                Oleksiy Balabay

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aurorius
                  wrote on last edited by
                  #11

                  I've updated the article from "pikopong":http://www.pikopong.com/blog/2010/04/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/ with some additional information. But the guide still works, I've tested it in my Virtual Box with a clean Windows XP (never install Qt or MySQL before in it). You can see the full build process "here":http://pastie.org/1348501

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    blueyes
                    wrote on last edited by
                    #12

                    The problem aurorius is, as I already said before, that this way I can build the driver but NOT the test application:

                    @#include <QtGui/QApplication>
                    #include <QCoreApplication>
                    #include <QDebug>
                    #include <QtSQL/QSqlDatabase>
                    #include "mainwindow.h"

                    int main(int argc, char *argv[])
                    {
                    QApplication a(argc, argv);
                    qDebug() << QSqlDatabase::drivers();

                    return a.exec&#40;&#41;;
                    

                    }@

                    Here are the errors I got:

                    @Running build steps for project SqlTest...
                    Configuration unchanged, skipping qmake step.
                    Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
                    mingw32-make: Entering directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                    C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

                    mingw32-make[1]: Entering directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\SqlTest.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4

                    mingw32-make[1]: Leaving directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                    mingw32-make: Leaving directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'

                    debug/main.o: In function `Z5qMainiPPc':

                    C:\Paolo\QtPtojects\SqlTest-build-desktop/../SqlTest/main.cpp:10: undefined reference to '_imp___ZN12QSqlDatabase7driversEv'

                    collect2: ld returned 1 exit status

                    mingw32-make[1]: *** [debug\SqlTest.exe] Error 1

                    mingw32-make: *** [debug] Error 2

                    The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
                    Error while building project SqlTest (target: Desktop)
                    When executing build step 'Make'@

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      aurorius
                      wrote on last edited by
                      #13

                      Just in case if you're wondering, this is the compile output for a working project

                      @Running build steps for project testmysql...
                      Configuration unchanged, skipping qmake step.
                      Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
                      mingw32-make: Entering directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                      C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

                      mingw32-make[1]: Entering directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                      g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtSql" -I"c:\Qt\2010.05\qt\include" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"..\testmysql" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\main.o ..\testmysql\main.cpp

                      g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\testmysql.exe debug/main.o -L"c:\Qt\2010.05\qt\lib" -lQtSqld4 -lQtCored4

                      mingw32-make[1]: Leaving directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                      mingw32-make: Leaving directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'

                      The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited normally.@

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        blueyes
                        wrote on last edited by
                        #14

                        Eventually I've been able to figure out why it didn't build: I had to manually add to the .pro file the SQL module.

                        QT += core gui sql

                        Now it works!

                        Many thanks again for the support.

                        1 Reply Last reply
                        0
                        • I Offline
                          I Offline
                          IrQX
                          wrote on last edited by
                          #15

                          [quote author="blueyes" date="1291600372"]Eventually I've been able to figure out why it didn't build: I had to manually add to the .pro file the SQL module.

                          QT += core gui sql

                          Now it works!

                          Many thanks again for the support.[/quote]

                          Next time read proper documentation. Paragraph modules. where write such "if you using sql write QT += sql", "If you using GUI, write QT += gui", etc..

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            chandan
                            wrote on last edited by
                            #16

                            hi all...
                            I am using ubuntu OS ..and I install Qt via downloading it from QT center.When I wrote this code I found only one driver that is "QSQLITE".
                            so how to install that I can work with QMYSQL driver

                            1 Reply Last reply
                            0
                            • F Offline
                              F Offline
                              franku
                              wrote on last edited by
                              #17

                              You've got to configure an build Qt with the QMYSQL Database driver enabled.

                              This, Jen, is the internet.

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved