September 30, 2011

debasishsahu4upp debasishsahu..
Lab Rat
1 posts

mysql installation for QT4.7 in windows 7



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.

  1. C:\QtSDK\QtSources\4.7.3\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=c:\Pro
  2. gram Files (x86)\MySQL\MySQL Server 5.5\include" "LIBS+=c:\Program Files (x86)\M
  3. ySQL\MySQL Server 5.5\lib\libmysql.lib" -o Makefile
  4. WARNING: (internal):1: Unescaped backslashes are deprecated.
  5. WARNING: (internal):1: Unescaped backslashes are deprecated.
  6. WARNING: (internal):1: Unescaped backslashes are deprecated.
  8. C:\QtSDK\QtSources\4.7.3\src\plugins\sqldrivers\mysql>mingw32-make
  9. mingw32-make -f Makefile.Debug
  10. mingw32-make[1]: Entering directory `C:/QtSDK/QtSources/4.7.3/src/plugins/sqldri
  11. vers/mysql'
  12. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
  15. AVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtCore"
  16. -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtSql" -I"c:\QtSDK\Desktop\Qt\4.7.3\m
  17. ingw\include" -I"c:\Program" -I"Files" -I"(x86)\MySQL\MySQL" -I"Server" -I"5.5\i
  18. nclude" -I"c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\ActiveQt" -I"debug" -I"c:\QtS
  19. DK\Desktop\Qt\4.7.3\mingw\mkspecs\default" -o debug\main.o main.cpp
  20. In file included from main.cpp:44:
  21. ../../../sql/drivers/mysql/qsql_mysql.h:52:19: error: mysql.h: No such file or d
  22. irectory
  23. In file included from main.cpp:44:
  24. ../../../sql/drivers/mysql/qsql_mysql.h:108: error: expected ')' before '*' toke
  25. n
  26. mingw32-make[1]: *** [debug/main.o] Error 1
  27. mingw32-make[1]: Leaving directory `C:/QtSDK/QtSources/4.7.3/src/plugins/sqldriv
  28. ers/mysql'
  29. mingw32-make: *** [debug] Error 2

need some help urgent..


3 replies

January 19, 2012

GroundZero GroundZero
Lab Rat
26 posts

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

January 25, 2012

Hostel Hostel
Lab Rat
171 posts

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.

January 25, 2012

Volker Volker
Ant Farmer
5331 posts

This line is the root of the errors:

  1. 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:

  1. 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

  ‹‹ [Moved] Qt4 application complete on linux! Now how to build it statically?      C1083: Cannot open include file: ’stddef.h’: No such file or directory ››

You must log in to post a reply. Not a member yet? Register here!