所以我已经阅读了几篇关于如何在 QT 中正确安装 QYMYSQL 驱动程序的指南,我什至阅读了与其他指南相矛盾的说明……真的很生气。无论如何,我已经到了在我的
...src\plugins\sqldrivers\mysql
目录中有这些文件/头文件的阶段......
mysql文件夹
问题是指南中的下一步是简单地运行
migw32-make
,我应该在我的目录中准备好 4 个文件(.dll 和 .a)吗?
但是,我不断收到一组错误,我不知道如何修复。这是我尝试 make 命令时发生的情况:
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql>mingw32-make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/4.8.4/src/plugins/sqldrivers/mysql'
g++ -mthreads -shared -Wl,--out-implib,c:\Qt\4.8.4\plugins\sqldrivers\libqsqlmys
qld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll tmp/obj/debug_shared/ma
in.o tmp/obj/debug_shared/qsql_mysql.o tmp/obj/debug_shared/moc_qsql_mysql.o -L
"c:\Qt\4.8.4\lib" -L"c:\Qt\4.8.4\lib" tmp\obj\debug_shared\qsqlmysqld_resource_r
es.o C:\MYSQL\lib\libmysql.lib -lQtSqld4 -lQtCored4
Creating library file: c:\Qt\4.8.4\plugins\sqldrivers\libqsqlmysqld4.a
tmp/obj/debug_shared/qsql_mysql.o: In function `codec':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:223: undefined reference to `mysql_character_set_name@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `qMakeError':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:234: undefined reference to `mysql_error@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:237: undefined reference to `mysql_errno@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `qMakeStmtError':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:309: undefined reference to `mysql_stmt_error@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:312: undefined reference to `mysql_stmt_errno@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN19QMYSQLResultPrivate12bindInV
aluesEv':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:358: undefined reference to `mysql_stmt_result_metadata@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:362: undefined reference to `mysql_num_fields@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:369: undefined reference to `mysql_fetch_field@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN12QMYSQLResult7cleanupEv':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:432: undefined reference to `mysql_free_result@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:438: undefined reference to `mysql_store_result@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:440: undefined reference to `mysql_free_result@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:437: undefined reference to `mysql_next_result@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:446: undefined reference to `mysql_stmt_close@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:452: undefined reference to `mysql_free_result@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN12QMYSQLResult5fetchEi':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:496: undefined reference to `mysql_stmt_data_seek@12'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:498: undefined reference to `mysql_stmt_fetch@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:513: undefined reference to `mysql_data_seek@12'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:514: undefined reference to `mysql_fetch_row@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN12QMYSQLResult9fetchNextEv':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:529: undefined reference to `mysql_stmt_fetch@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:544: undefined reference to `mysql_fetch_row@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN12QMYSQLResult9fetchLastEv':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:565: undefined reference to `mysql_stmt_num_rows@4'
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:570: undefined reference to `mysql_num_rows@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN12QMYSQLResult4dataEi':
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:614: undefined reference to `mysql_fetch_lengths@4'
tmp/obj/debug_shared/qsql_mysql.o: In function `ZN12QMYSQLResult5resetERK7QString':
它以类似的模式不断重复,直到结束:
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql.c
pp:1516: undefined reference to `mysql_real_escape_string@16'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/4.8.4/src/plugins/sqldrivers/mysql'
mingw32-make: *** [debug-all] Error 2
C:\Qt\4.8.4\src\plugins\sqldrivers\mysql>
我不知道我是否做错了什么,或者我应该重新安装并遵循不同的安装指南,因为有很多。如果有人能告诉我为什么它会窒息或指向我一个可靠且实际有效的安装指南,我将不胜感激
提前致谢
更新已解决
我并没有真正弄清楚问题是什么,但猜测它与不兼容有关......无论如何,我通过使用另一个软件附带的不同 mysql 安装文件来解决它,Xampp 我已经安装了很久以前。现在我可以将 QMYSQL 插件与 Qt 一起使用,它工作正常!!!