我参照这位大佬的文章,及其中的评论:
http://t.csdnimg.cn/1Nc6a?%ra
mysql.pro:
TARGET = qsqlmysql
HEADERS += $$PWD/qsql_mysql_p.h
SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
#QMAKE_USE += mysql
OTHER_FILES += mysql.json
PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
include(../qsqldriverbase.pri)
INCLUDEPATH += $$quote("D:\MySQL\MySQL Server 8.0\include")
LIBS += $$quote("D:\MySQL\MySQL Server 8.0\lib\libmysql.lib")
DESTDIR = ../mysql/lib/
qsqldriverbase.pri:
QT = core core-private sql-private
# For QMAKE_USE in the parent projects.
#include($$shadowed($$PWD)/qtsqldrivers-config.pri)
include(./configure.pri)
PLUGIN_TYPE = sqldrivers
load(qt_plugin)
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
结果出了104个错误,都是无法解析的外部符号错误
后来我发现,原来构建套件用的是MSVC32bit,与我64位的MySql不符合,疏忽了,不过无法解析的外部符号,这点确实没能让我看出来它
随便写写,没什么水平,只是很感兴趣csdn创作的功能,试试看(@。@)