MySql plugin for windows
-
wrote on 6 May 2011, 15:13 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 -
wrote on 6 May 2011, 16:37 last edited by
Just call qmake by it's full path.
-
wrote on 9 May 2011, 10:51 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.
-
wrote on 9 May 2011, 10:59 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.
-
wrote on 9 May 2011, 11:24 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)
-
wrote on 13 Jul 2011, 23:03 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/
-
wrote on 13 Jul 2011, 23:43 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)
-
wrote on 14 Jul 2011, 10:06 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.
-
wrote on 23 Aug 2011, 03:36 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!! -
wrote on 12 Oct 2011, 13:13 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............
-
wrote on 12 Oct 2011, 13:22 last edited by
There is no need to reimp a thing... check the tutorial
-
wrote on 12 Oct 2011, 13:53 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 directoryE:/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 2E:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\mysql>
-
wrote on 12 Oct 2011, 17:30 last edited by
The problem is with your SQL Library, it was not properly included into the project.
-
wrote on 12 Oct 2011, 17:37 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.