如何在Qt SDK for Windows中启用MySQL支持

时间:2011-06-01 14:21:21

标签: mysql qt4 makefile

我正在尝试构建一个驱动程序,以便将Qt与MySQL连接

我按照此网络链接中的步骤操作 http://www.pikopong.com/blog/2010/04/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/ 但是当我输入命令mingw32-make

时出错了

错误是:

C:\Qt\2009.04\qt\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Qt/2009.04/qt/src/plugins/sqldrivers/mys
ql'
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_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\i
nclude\QtSql" -I"..\..\..\..\include" -I"c:\MySQL\MySQL" -I"Server" -I"5.5\inclu
de" -I"..\..\..\..\include\ActiveQt" -I"debug" -I"..\..\..\..\mkspecs\win32-g++"
 -o debug\main.o main.cpp
In file included from main.cpp:44:
../../../sql/drivers/mysql/qsql_mysql.h:52:19: mysql.h: No such file or director
y
In file included from main.cpp:44:
../../../sql/drivers/mysql/qsql_mysql.h:107: error: expected `)' before '*' toke
n
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/2009.04/qt/src/plugins/sqldrivers/mysq
l'
mingw32-make: *** [debug] Error 2

C:\Qt\2009.04\qt\src\plugins\sqldrivers\mysql>mingw32-make
*******************

请帮我解决这个问题。我怎么能解决这个错误?

提前致谢! 沃利!

1 个答案:

答案 0 :(得分:0)

IIANM,您不应该将%mySQLDIR%设置为包含空格的路径。它应该是诸如set %mySQLDIR%=C:\MySQL\MYSQLS~1.1之类的东西。您可以使用dir /x检查正确的短路径。

举个例子:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\>cd MySQL

C:\MySQL>dir /x
 Volume in drive C is BOOTCAMP
 Volume Serial Number is 785F-A9E4

 Directory of C:\MySQL

07/11/2011  07:23 PM    <DIR>                       .
07/11/2011  07:23 PM    <DIR>                       ..
07/11/2011  07:23 PM    <DIR>          MYSQLS~1.1   MySQL Server 5.1
               0 File(s)              0 bytes
               3 Dir(s)  46,921,265,152 bytes free

C:\MySQL>cd MYSQLS~1.1

C:\MySQL\MYSQLS~1.1>