我的是QT4.2.3的window开源版,
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.QSqlDatabase::contains("QMYSQL") );
上面一行返回false,查看D:\Qt\4.2.3\plugins\sqldrivers目录发现没有libqsqlmysql.a, qsqlmysql.dll两个文件,然后照着置顶的帖子安装MYSQL插件在
cd D:\Qt\4.2.3\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=d:\MYSQL\INCLUDE" "LIBS+=d:\MYSQL\LIB\OPT\LIBMYSQL.a" mysql.pro
make
后出现:
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `D:/Qt/4.2.3/plugins/sqldrivers/mysql'
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,windows -o "debug\sql.exe" -L"d:\Qt\4.2.3\lib" -L"d:\Qt\4.2.3\lib" -lmingw32 -lqtmaind D:\MYSQL\LIB\OPT\LIBMYSQL.a -lQtGuid4 -lQtCored4
d:\Qt\4.2.3\lib/libqtmaind.a(qtmain_win.o)(.text+0x30b):In function 'WInMain':
D:/qt/4.2.3/src/winmain/qtmain_win.cpp:105:undefined reference to 'qMain(int,char**)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [d:\Qt\4.1.1\plugins\sqldrivers\qsqlmysql.dll] Error 1
mingw32-make[1]: Leaving directory `D:/Qt/4.2.3/plugins/sqldrivers/mysql'
mingw32-make: *** [release] Error 2
这是什么问题。。急,希望各位大虾帮忙。。谢谢
[ 此贴被XChinux在2007-08-12 23:06重新编辑 ]