Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MySql plugin for windows

MySql plugin for windows

Scheduled Pinned Locked Moved General and Desktop
14 Posts 8 Posters 12.5k Views
  • 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.
  • A Offline
    A Offline
    Aicou
    wrote on 6 May 2011, 15:13 last edited by
    #1

    Hello,
    I tried today to port one of my soft on windows (with Qt creator, basic install). but I can't build the QMYSQL Plugin. I look at the doc who say
    @cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro
    nmake @

    I tried it but the windows "power" shell didn't recognize qmake. I'm not an expert on windows and I could use a little help on this.

    Thanks
    Aicou

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on 6 May 2011, 16:37 last edited by
      #2

      Just call qmake by it's full path.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Aicou
        wrote on 9 May 2011, 10:51 last edited by
        #3

        Thanks Volker. (I guess I was tired ..), Now I get this error (in command-line and in Qtcreator)

        @qsql_mysql.obj:-1: erreur : LNK2019: unresolved external symbol _mysql_list_tables@8 referenced in function "public: virtual class QStringList __thiscall QMYSQLDriver::tables(enum QSql::TableType)const " (?tables@QMYSQLDriver@@UBE?AVQStringList@@W4TableType@QSql@@@Z)@

        for 50 different link.

        here is my .pro :

        @TARGET = qsqlmysql

        INCLUDEPATH +=C:\MySQL\include

        LIBS +=C:\MySQL\lib\libmysql.lib

        SOURCES = main.cpp
        include(../../../sql/drivers/mysql/qsql_mysql.pri)

        include(../qsqldriverbase.pri)@

        C:\MySQL\ is my MySQL install dir, i used the MySQL Community Server 5.5.12.

        the libmysql.lib link is correct and i don't understand why it's not working.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 9 May 2011, 10:59 last edited by
          #4

          The problem is, that MySQL is build using the MSVC compiler, and you can't just link against it using MinGqw32 without doing "some other work":http://www.qtcentre.org/wiki/index.php?title=Building_the_QMYSQL_plugin_on_Windows_using_MinGW first.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Aicou
            wrote on 9 May 2011, 11:24 last edited by
            #5

            I followed this link before trying with Qtcreator,
            It generate the makefile, the makefile.debug and makefile.release but when i use mingw32-make on it I got this:

            @Makefile.Debug:61: *** missing separator. Stop.
            mingw32-make[1]: Leaving directory `C:/QtSDK/QtSources/4.7.3/src/plugins/sqldrivers/mysql'
            mingw32-make: *** [debug] Error 2@

            the corresponding line on makefile.debug is :

            @{......\sql\drivers\mysql}.cpp{debug}.obj::
            $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<<
            $<
            <<@

            (line 4 here)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aurorius
              wrote on 13 Jul 2011, 23:03 last edited by
              #6

              Try reading this post: "Enabling MySQL Plugin":http://www.pikopong.com/blog/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows-part-2/

              New URL: http://ieatbinary.com/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/

              1 Reply Last reply
              0
              • U Offline
                U Offline
                ucomesdag
                wrote on 13 Jul 2011, 23:43 last edited by
                #7

                [quote author="aurorius" date="1310598231"]Try reading this post: "Enabling MySQL Plugin":http://www.pikopong.com/blog/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows-part-2/[/quote]Just one remark on the the howto you refer to. It would be cleaner to copy libmysql.dll to the bin directory where all the Qt dll's live.

                Don't forget to distibute libmysql.dll with your executable and ship qsqlmysql4.dll in the subdirectory sqldrivers (relative to your executables root)

                Write “Qt”, not “QT” (QuickTime).

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  p91paul
                  wrote on 14 Jul 2011, 10:06 last edited by
                  #8

                  the tutorial says that you have to copy libmysql.dll in C:\Windows; in fact I have copied it in Qt/Desktop/Qt/4.7.3/mingw/bin and it works without using system directories. When deploying, you have to follow ucomesdag advice.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Cayan
                    wrote on 23 Aug 2011, 03:36 last edited by
                    #9

                    [quote author="aurorius" date="1310598231"]Try reading this post: "Enabling MySQL Plugin":http://www.pikopong.com/blog/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows-part-2/[/quote]

                    Thanks!!! The first tutorial which worked perfectly!!!
                    The finest!
                    Thanks once again!!

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      dmitrij
                      wrote on 12 Oct 2011, 13:13 last edited by
                      #10

                      Actually it doesn't=) Because there is no such command as reimp or may be in qt command promt what I have is something wrong............

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Cayan
                        wrote on 12 Oct 2011, 13:22 last edited by
                        #11

                        There is no need to reimp a thing... check the tutorial

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          dmitrij
                          wrote on 12 Oct 2011, 13:53 last edited by
                          #12

                          I did it. So I got the following result:

                          E:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>mingw32-make
                          mingw32-make -f Makefile.Debug
                          mingw32-make[1]: Entering directory E:/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/mysql' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_ ngw\include\QtCore" -I"e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql" -I"e:\QtSDK\Desktop\Qt\4.7.4\mingw\include" -I"c:\PROGRA~2\MySQL\MYSQLS~1.5\inclu In file included from ../../../sql/drivers/mysql/qsql_mysql.h:52, from main.cpp:44: e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:70:27: error: mysql_version.h: No such file or directory e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:71:23: error: mysql_com.h: No such file or directory e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:72:24: error: mysql_time.h: No such file or directory e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:74:70: error: my_list.h: No such file or directory e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:132:21: error: typelib.h: No such file or directory e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:147:22: error: my_alloc.h: No such file or directory In file included from ../../../sql/drivers/mysql/qsql_mysql.h:52, from main.cpp:44: e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:115: error: use of enum 'enum_field_types' without previous declaration e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:153: error: 'MEM_ROOT' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:260: error: 'NET' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:266: error: 'MEM_ROOT' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:285: error: 'SCRAMBLE_LENGTH' was not declared in this scope e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:302: error: ISO C++ forbids declaration of 'LIST' with no type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:302: error: expected ';' before '*' token e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:326: error: 'MEM_ROOT' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:350: error: 'NET' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:518: error: use of enum 'mysql_enum_shutdown_level' without previous declaration e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:525: error: use of enum 'enum_mysql_set_option' without previous declaration e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:662: error: 'NET' has not been declared e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:673: error: use of enum 'enum_field_types' without previous declaration e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:685: error: 'MEM_ROOT' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:686: error: 'LIST' does not name a type e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:714: error: 'MYSQL_ERRMSG_SIZE' was not declared in this scope e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:715: error: 'SQLSTATE_LENGTH' was not declared in this scope e:\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtSql/mysql.h:757: error: use of enum 'enum_server_command' without previous declaration mingw32-make[1]: *** [debug/main.o] Error 1 mingw32-make[1]: Leaving directory E:/QtSDK/QtSources/4.7.4/src/plugins/sqldrivers/mysql'
                          mingw32-make: *** [debug] Error 2

                          E:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            Cayan
                            wrote on 12 Oct 2011, 17:30 last edited by
                            #13

                            The problem is with your SQL Library, it was not properly included into the project.

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              dmitrij
                              wrote on 12 Oct 2011, 17:37 last edited by
                              #14

                              Thank you for you answers.
                              I guess, I have to install qt and mysql on the same disk and see, what will happen. Because in command prompt for some reason I can't change the disk letter. May be only problem was in a drive letter. I'm not sure. In linux it wasn't that hard.

                              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