Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    MySql plugin for windows

    General and Desktop
    8
    14
    11802
    Loading More Posts
    • 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
      Aicou last edited by

      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 Reply Quote 0
      • G
        goetz last edited by

        Just call qmake by it's full path.

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

        1 Reply Last reply Reply Quote 0
        • A
          Aicou last edited by

          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 Reply Quote 0
          • A
            andre last edited by

            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 Reply Quote 0
            • A
              Aicou last edited by

              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 Reply Quote 0
              • A
                aurorius last edited by

                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 Reply Quote 0
                • U
                  ucomesdag last edited by

                  [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 Reply Quote 0
                  • P
                    p91paul last edited by

                    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 Reply Quote 0
                    • C
                      Cayan last edited by

                      [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 Reply Quote 0
                      • D
                        dmitrij last edited by

                        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 Reply Quote 0
                        • C
                          Cayan last edited by

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

                          1 Reply Last reply Reply Quote 0
                          • D
                            dmitrij last edited by

                            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 Reply Quote 0
                            • C
                              Cayan last edited by

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

                              1 Reply Last reply Reply Quote 0
                              • D
                                dmitrij last edited by

                                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 Reply Quote 0
                                • First post
                                  Last post