QMYSQL driver not loaded - qt

I have compiled qmysql driver plugin and placed debug and release .dll and .lib files in \plugins\sqldrivers. But when i try qDebug() << QSqlDatabase::drivers(); it still get ("QSQLITE", "QODBC3", "QODBC", "QPSQL7", "QPSQL")and QMYSQL driver is not available.Any idea?
Qt version : 4.8.4
Compiler : MSVC2010
OS : windows vista (64bit)

Your application needs libmysql.dll which you can find in the MySQL installation directory. You can copy it to the Qt bin directory or in the same directory of your .exe
Note that you need to restart your IDE (Qt Creator or what ever IDE) after you place new dll files in \plugins\sqldrivers or Qt bin directory.

Related

Qt.labs.plarform is not installed only in release mode

I am using FileDialog from Qt.labs.platform 1.1 on win 10 in Qt creator, compilator I use is Desktop Qt 5.15.2. MinGW 64 bit.
In the debug mode is working everthing fine but when I change to release mode I get following error in from the compilator:
QQmlApplicationEngine failed to load component
qrc:/main.qml:6:1: module "Qt.labs.platform" is not installed
I tried things like clean and rebuild or restart the computer and also change the number of import version but nothing helps. Any ideas how to solve that, please?
Check folder, where you are building your release (where *.exe is generated):
does it contains some Qt's *.dll's?
If yes: there is two ways to resolve your problem:
Remove all Qt *.dll's and run your application from Qt Creator (then Qt Creator will take all Qt *.dll's from folder, where Qt is installed).
Or add all needed Qt *.dll's with correct folder structure to folder with your release *.exe (to do it for Windows release use windeployqt tool: https://doc.qt.io/qt-6/windows-deployment.html )
Why you have such error from the compilator?
Because you have some Qt *.dll's in your release folder (beside the *.exe), but not all needed (e.g. you have only Qt6Core.dll). So Qt Creator will find this dll and will try to find other dll's in your release folder. Qt Creator will not check its installation directory to get dll's.
But if you have no Qt *.dll's in your release folder, then Qt Creator will find them in its installation directory.

Cannot find .pro file in Qt Creator

I'm new to Qt, learning through a Qt Creator tutorial. I am trying to connect Qt with a MySQL database. To do so, I have to modify a .pro file adding the command QT += core sql
However, once I create a project there is no .pro file in the menu, only the .ccp file.
Program installed: Qt Creator 4.13.0
OS: Windows 10 x64
Steps followed:
Choose New Project
Choose Qt Console Application
Build system: CMake
Kits: I have some available; I am using Qt 5.15.1 MSVC2019 64bit
The menu displayed shows a CMakesList.txt file, and the main.ccp source file. However no .pro file is created.
For new build system you should modify CMakeList.txt file.
Please try to replace
target_link_libraries(myapp Qt5::Gui)
with
target_link_libraries(myapp Qt5::Gui Qt5::Sql)

I get sqldriver error in QtCreator

I try to write a program in Qt Creator using db library. When i run my application in Qt Creator, i get that error: "QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE"
The qsqlodbc.dll and qsqlodbcd.dll files exist in the plugins/sqldrivers folder of the Qt 5.1.0 installation.
Why can not it find the driver altough it exits in the default installation?
Thanks

Can't find libgcc_s_dw2-1.dll in QT 5.0.1

I'm trying to run my "hello world" on Windows XP 32bit. I know that I must deploy some libs with my exe but can't find libgcc_s_dw2-1.dll in QT directory. I thought that all mingw libs are ships with QT instalator. Why it is missing? Must I download mingw and copy it?
If you use MinGWs compiler to compile your "hello world", than you already have all needed files in your system. libgcc_s_dw2-1.dll is MinGWs library, you can find it in path where your MinGW is installed ...\MinGW\bin\libgcc_s_dw2-1.dll.
And try to make search on all of your system for that file.

Building Qt 4.7.3 (latest) on windows

I have downloaded the open source version of Qt 4.7.3, run configure.exe to configure it, how do I then build it (to have a qmake.exe I can use) on windows?
if you do configure -platform win32-msvc2010 (or2008 etc) it will generate a vs2010 project, just open the .sln and built it.
configure.exe should have caused qmake.exe to build. You'll want to add its location to your path. (It's in the bin directory of your Qt installation).

Resources