windows7安装 Qt5.13.0
https://download.qt.io/official_releases/qt/5.13/5.13.0/
下载: qt-opensource-windows-x86-5.13.0.exe,
安装路径:D:Qt,选择:MinGw32和Src
加入系统路径PATH:
D:QtQt5.13.0Toolsmingw730_32in;
D:QtQt5.13.0ToolsQtCreatorin;
D:QtQt5.13.05.13.0mingw73_32in
-------------------------------------------------------------------------------
编译mysql for Qt驱动
1.编辑源码:D:QtQt5.13.05.13.0Srcqtbasesrcpluginssqldriversmysqlmysql.pro
include(D:QtQt5.13.05.13.0Srcqtbasesrcpluginssqldriversconfigure.pri)
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)
win32:LIBS += -LD:mysql-5.5.39-win32lib -llibmysql
INCLUDEPATH += D:mysql-5.5.39-win32include
DEPENDPATH += D:mysql-5.5.39-win32include
构建项目成功
D:pluginssqldrivers
libqsqlmysql.a
libqsqlmysqd.a
qsqlmysql.dll
qsqlmysqld.dll
--------------------------------------------------------------------------------
1 把刚刚生成的 qsqlmysql.dll,qsqlmysqld.dll
拷贝到D:QtQt5.13.05.13.0mingw73_64pluginssqldrivers
2 把Mysql的libmysql.dll文件:D:mysql-5.5.39-win32liblibmysql.dll
拷贝到D:QtQt5.13.05.13.0mingw73_64in
3 要使用mysql的项目pro文件要加入 QT += sql
测试成功