mysql - 未加载 Qt QMYSQL 驱动程序和可用驱动程序:(为空)(Linux)
问题描述
我构建了 QMYSQL 驱动程序,但是当我运行我的程序时出现此错误:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers:
这是我的so文件已编译的路径:
/home/uia53314/Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers/plugins/sqldrivers
ls :
libqsqlite.so libqsqlite.so.debug libqsqlmysql.so libqsqlmysql.so.debug
/Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers$ ls:
config.cache libqsqlite.so psql
config.log libqsqlite.so.debug qsqldriverbase.pri
config.opt libqsqlmysql.so qtsqldrivers-config.h
config.summary libqsqlmysql.so.debug qtsqldrivers-config_p.h
config.tests Makefile qtsqldrivers-config.pri
configure.json mkspecs README
configure.pri mysql sqldrivers.pro
db2 oci sqlite
ibase odbc sqlite2
lib plugins tds
在 /Qt5.13.0/5.13.0/Src/qtbase/src/plugins/sqldrivers 中运行 qmake sqldrivers.pro 给我:
配置摘要:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. yes
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into '/home/uia53314/Qt5.13.0/5.13.0/gcc_64'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
我需要在我的个人资料中添加一些东西以使程序看到驱动程序:
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += core gui charts sql
TARGET = WebmPlayer
TEMPLATE = app
CONFIG += c++11
QTPLUGIN += qsqlmysql
DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
TEMPLATE = app
INCLUDEPATH += /usr/local/include/
LIBS += -L/usr/local/lib -lcurlpp -lcurl
LIBS += -L/usr/local/lib/x86_64-linux-gnu -lmysqlclient
CONFIG += console link_pkgconfig
#CONFIG -= app_bundle qt
PKGCONFIG += vpx opus vorbis
INCLUDEPATH = . libwebm
DEPENDPATH = . libwebm
解决方案
推荐阅读
- node.js - cy.readFile 导致超时?
- php - 使用或不使用锚点调用 URL 时的 $_GET 差异
- python - 如何清理dataframe的脏数据(从csv文件导入),过滤nums并转入float类型
- python - 为什么我需要设置尾值来修改链表中的头值
- shell - 如何在 shell 脚本中打印“*”的 Z 形?
- typescript - 从 proto 文件生成打字稿文件的问题
- java - Logback Logger 没有 Appender
- kubernetes - 如何为 kubelet 服务器证书启用自动 CSR 批准?
- jquery - 使用双击表更改文本框值
- android - 当我在风味发行版中签署 APK 时,风味发行版中未生成的外部库仍保留在 Debug 中?