我下载的是官方的qt的sdk,mysql也正常,
参照 qt的帮助文档sql-driver.html中是这样说的
How to Build the QMYSQL Plugin on Windows
You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MYSQL\MySQL Server <version>\lib\opt\libmysql.lib" mysql.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in the line above.
Note: This database plugin is not supported for Windows CE.
Note: Including "-o Makefile" as an argument to qmake to tell it where to build the makefile can cause the plugin to be built in release mode only. If you are expecting a debug version to be built as well, don't use the "-o Makefile" option.
第2各命令行我改用我实际的mysql的include,lib路径
qmake "INCLUDEPATH+=C:\mysql\mysql-5.0.22-win32\include" "LIBS+=C:\mysql\mysql-5.0.22-win32\lib\opt\libmysql.lib" mysql.pro
执行完全正常。最后的编译nmake总失败(nmake路径没问题,已经设了环境变量,可以使用该命令)
nmake:fatal error U1073:不知道如何生成"c:/Program\"
stop.
nmake:fatal error U1077: "D:\visual studio 2005\vc\bin\nmake.exe"返回代码"0x2" stop
换用make 也失败
make[1] [tmp/obj/debug_shared/main.o] Error 1
leaving directory 'd:\qt\src\plugins\sqldrivers\mysql'
什么原因呢??