MySQL + Qt4 + Windows7 = problems [SOLVED]



  • Hello!

    First of all, I'm kinda new to Qt, and especially to MySQL,
    so sorry if I did newbie mistakes, but I cannot solve it by myself.

    I met some problems, while I wanted to set up MySQL for my Qt4.
    I did exactly the discibed steps, from for eg:
    http://ieatbinary.com/2011/07/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/
    and
    http://qt-project.org/forums/viewthread/15405/ ( they had errors at this point too )

    I installed the last QtSources, I downloaded and installed "mysql-5.5.23-win32", from the MySQL's homepage.

    And I successfully did the first few steps, and then I got some wild errors after the "mingw32-make" command.

    D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mySQL
    DIR%\include" "LIBS+=%mySQLDIR%\lib\opt\libmysql.lib"-o Makefile mysql.pro
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    d:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\mysql\Makefile:9: Parse Error ('
    first: release')
    Error processing project file: Makefile
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.

    D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory D:/QtSDK/QtSources/4.8.1/src/plugins/sqldri vers/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_SQL_LIB - DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_H AVE_SSE2 -DQT_THREAD_SUPPORT -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtCore" -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\include\QtSql" -I"d:\QtSDK\Desktop\Qt\4.8.0\m ingw\include" -I"d:\MySQL\include" -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\include\Ac tiveQt" -I"debug" -I"d:\QtSDK\Desktop\Qt\4.8.0\mingw\mkspecs\default" -o debug\m ain.o main.cpp In file included from main.cpp:44: ../../../sql/drivers/mysql/qsql_mysql.h:52:19: error: mysql.h: No such file or d irectory In file included from main.cpp:44: ../../../sql/drivers/mysql/qsql_mysql.h:108: error: expected ')' before '*' toke n mingw32-make[1]: *** [debug/main.o] Error 1 mingw32-make[1]: Leaving directoryD:/QtSDK/QtSources/4.8.1/src/plugins/sqldriv
    ers/mysql'
    mingw32-make: *** [debug] Error 2

    I couldn't find any solutions on the internet.
    Does anyone have any idea, why it can't find mysql.h? ( It is in the MySQL's directory, so... )

    Sincerely,
    SB


  • Moderators

    welcome to devnet

    As it looks you have already errors a step earlier. The qmake does have an error message you need to follow up.

    @
    D:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\mysql>qmake “INCLUDEPATH+=%mySQL
    DIR%\include” “LIBS+=%mySQLDIR%\lib\opt\libmysql.lib”-o Makefile mysql.pro
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    d:\QtSDK\QtSources\4.8.1\src\plugins\sqldrivers\mysql\Makefile:9: Parse Error (’
    first: release’)
    Error processing project file: Makefile
    @



  • Ok, I think I found out what was the problem.

    Koahnig, thank you for the advice, but those werent serious problems. I ignored all the warnings about backslashes ( why should I \ if it is a path... ).

    The main reason was the path of mysql directory.
    mysql="D:\MySQL\MYSQLS~1.5" was the solution. When I used the mysql variable withot the quotes, it didn't want to work. Maybe the reason is, it is a simple string.

    I googled all day long, and I couldn't find any solution, while a LOT of people are having the same problem... So, if you have this problem, I suggest you, to try it: While using, Start -> QtSDK -> Desktop -> Qt 4.8.0 for Desktop (MinGW)
    Obviously edit it, as your installation paths.

    1. ) > cd D:\MySQL\

    2.) D:\MySQL> dir /x

    Directory of D:\MySQL

    2012.04.15. 18:55 <DIR> .
    2012.04.15. 18:55 <DIR> ..
    2012.04.15. 18:55 <DIR> MYSQLS~1.5 MySQL
    0 File(s) 0 bytes
    3 Dir(s) 169 148 235 776 bytes free

    3.) > mysql="D:\MySQL\MYSQLS~1.5"
    4.) > cd
    5.) > cd QtSDK\QtSources\4.7.3\src\plugins\sqldrivers\mysql\

    6.) > qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro
    7.) > mingw32-make

    8.) > qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro "CONFIG+=release"
    9.) > mingw32-make

    It worked for me.

    Sincerely,
    SB



  • Using forward slashes on all platforms also solves this issue.



  • Remember to change the topic title to [SOLVED] ^_^


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.