qt中使用无法使用MySQL驱动该怎么解决啊???求大佬解答解答

weixin_40842562 2019-01-12 01:32:12
在编译好arm版本的MySQL驱动libqsqlmysql.so驱动,在移植到嵌入式设备上执行显示下面的这个情况,说是驱动没有加载,但是明明驱动已经放到了plugin中的sqldriver中的,但是显示还是没有加载驱动!!!求大佬帮忙,已经卡在这很久了。实在是解决不了。

下面是我用来测是mysql驱动的程序的main.cpp文件:

#include "widget.h"
#include <QApplication>
#include<QtSql/QSqlDatabase>
#include<QtSql/QSqlQuery>
extern "C"{
#include "stdio.h"
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
QSqlQuery query;
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("192.168.12.95");
db.setDatabaseName("finger");
db.setUserName("finger");
db.setPassword("qrszwxt");
db.setPort(3306);
if(db.open())
{
w.show();
printf("successful!!!\n");

}else{
printf("lianjie failed!\n");

}

return a.exec();
}


.pro中的文件内容是:

#-------------------------------------------------
#
# Project created by QtCreator 2018-12-27T16:07:30
#
#-------------------------------------------------

QT += core gui sql

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = untitled10
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0


SOURCES += \
main.cpp \
widget.cpp

HEADERS += \
widget.h

FORMS += \
widget.ui


...全文
442 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
刘晋龙 2021-11-19
  • 打赏
  • 举报
回复

您好,您的问题解决了吗

weixin_40842562 2019-01-16
  • 打赏
  • 举报
回复
引用 2 楼 weixin_43895194的回复:
我的也是,好像得放在32位
你说的是指win系统吧,你有做过arm linux设备移植qt数据库的
weixin_40842562 2019-01-16
  • 打赏
  • 举报
回复
引用 1 楼 h391998495979的回复:
我在window下是放入32位驱动才解决的
PC版本的不管是windows还是linux我的都能运行,但是放移植到arm设备上就不行,无法检测到
weixin_43895194 2019-01-15
  • 打赏
  • 举报
回复
我的也是,好像得放在32位
  • 打赏
  • 举报
回复
我在window下是放入32位驱动才解决的

19,502

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧