Qt 4.7.4, MySQL and Windows 7
-
Hi all, i have problem with building MySQL database with QT on Windows. I trying 3 days but i cant do this. I have MySQL Connector C++ 1.1.0. I'm doing everything step-by-step from this site: http://www.pikopong.com/blog/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows-part-2/
I have first problem with command
@qmake "INCLUDEPATH+=D:/PROGRA~1/MySQL/MYSQLC~1.0/include" "LIBS+=D:/PROGRA~1/MySQL/MYSQLC~1.0/lib/opt/mysqlcppconn.lib" -o Makefile mysql.pro@
I dont have mysql.pro in the folder so i'm create a empty txt file and rename it to "mysql.pro". Now this command works, but i have big problem on mingw32-make command, i've got this: @mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directoryD:/QtSDK/Desktop/Qt/4.7.4/mingw/plugins/sql drivers/mysql' g++ -mthreads -Wl,-subsystem,windows -o debug\mysql.exe -L"d:\QtSDK\Desktop\Qt \4.7.4\mingw\lib" -lmingw32 -lqtmaind D:/PROGRA~1/MySQL/MYSQLC~1.0/lib/debug/mys qlcppconn.lib -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib d:\QtSDK\Desktop\Qt\4.7.4\mingw\lib/libqtmaind.a(qtmain_win.o): In function
Win
Main@16':
c:/ndk_buildrepos/qt-desktop/src/winmain/qtmain_win.cpp:131: undefined reference
toqMain(int, char**)' collect2: ld returned 1 exit status mingw32-make[1]: *** [debug\mysql.exe] Error 1 mingw32-make[1]: Leaving directory
D:/QtSDK/Desktop/Qt/4.7.4/mingw/plugins/sqld
rivers/mysql'
mingw32-make: *** [debug] Error 2@
So what i should do?Sorry for my bad english (or not? :P).
-
[quote author="tomi127" date="1318349919"]I dont have mysql.pro in the folder ...
mingw32-make[1]: Entering directory `D:/QtSDK/Desktop/Qt/4.7.4/mingw/plugins/sql
drivers/mysql'[/quote]
Your current directory is wrong. Change it to :
d:\QtSDK\ QtSources \4.7.3\src\plugins\sqldrivers\mysql\ -
Hi, thanks for Your reply. Unfortunately your method don't work. I don't have 'QtSources' folder. So I create folder and change the directory but i got the same error :(
@mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directoryd:/QtSDK/QtSources/4.7.4/src/plugins/sqldri vers/mysql' g++ -mthreads -Wl,-subsystem,windows -o debug\mysql.exe -L"d:\QtSDK\Desktop\Qt \4.7.4\mingw\lib" -lmingw32 -lqtmaind D:/PROGRA~1/MySQL/MYSQLC~1.0/lib/opt/mysql cppconn.lib -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib d:\QtSDK\Desktop\Qt\4.7.4\mingw\lib/libqtmaind.a(qtmain_win.o): In function
Win
Main@16':
c:/ndk_buildrepos/qt-desktop/src/winmain/qtmain_win.cpp:131: undefined reference
toqMain(int, char**)' collect2: ld returned 1 exit status mingw32-make[1]: *** [debug\mysql.exe] Error 1 mingw32-make[1]: Leaving directory
d:/QtSDK/QtSources/4.7.4/src/plugins/sqldriv
ers/mysql'
mingw32-make: *** [debug] Error 2@Any ideas?
-
@QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL QPSQL7 QPSQL@
Thanks a lot! If somebody can't build MySQL you CAN'T use MySQL C++ Connector. Just do exactly steps from link in post #1.I did some otherwise... and that was the reason of this subject.
Sorry for problem. -
[quote author="tomi127" date="1318540350"]@If somebody can't build MySQL you CAN'T use MySQL C++ Connector.[/quote]
What do you mean ? I use only "My SQL Connector/C++":http://www.mysql.com/downloads/connector/cpp/. It works with both VC and MinGW compilers.