Important: Please read the Qt Code of Conduct -

Mysql installation for QT4.7 in windows 7

  • Hello,

    I'm using QT4.7.3 installed mysql 5.5 in windows 7 32bit. I need to install mysql for qt . I folled the following steps and found the error.

    C:\QtSDK\QtSources\4.7.3\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=c:\Pro
    gram Files (x86)\MySQL\MySQL Server 5.5\include" "LIBS+=c:\Program Files (x86)\M
    ySQL\MySQL Server 5.5\lib\libmysql.lib" -o Makefile
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.

    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory C:/QtSDK/QtSources/4.7.3/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"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.3\m ingw\include" -I"c:\Program" -I"Files" -I"(x86)\MySQL\MySQL" -I"Server" -I"5.5\i nclude" -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\ActiveQt" -I"debug" -I"c:\QtS DK\Desktop\Qt\4.7.3\mingw\mkspecs\default" -o debug\main.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 directoryC:/QtSDK/QtSources/4.7.3/src/plugins/sqldriv
    mingw32-make: *** [debug] Error 2@

    need some help urgent..


  • I have this problem to and no one knows a solution ><

  • Spaces in path to MySql could make issue. Try something like this:

    1. create dir like C:\MySql_5.5
    2. copy include folder to new directory
    3. copy lib folder to new directory

    After this steps try run qmake, but with new directory in INCLUDEPATH and LIBS.

  • This line is the root of the errors:

    qmake "INCLUDEPATH+=c:\Program Files (x86)\MySQL\MySQL Server 5.5\include" "LIBS+=c:\Program Files (x86)\MySQL\MySQL Server 5.5\lib\libmysql.lib" -o Makefile

    You will have to add quotes for paths containing spaces in it, otherwise qmake thinks it is actually two paths

    Always use forward slashes instead of backslashes, qmake translates it automagically to the version the platform needs.

    The LIBS variable should contain the directory containing the libraries, not the path the library itself (the .pro file already wants to link against it!). Prepend the path with -L.

    So, change your qmake call to:

    qmake 'INCLUDEPATH+="c:/Program Files (x86)/MySQL/MySQL Server 5.5/include"' 'LIBS+=-Lc:/Program Files (x86)/MySQL/MySQL Server 5.5/lib'" -o Makefile

Log in to reply