QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.14.2/5.14.2/mingw73_32/plugins/sqldrivers/qsqlpsql.dll"
-
Hi:
I have a weird problem:
This is my code:
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL"); //QMYSQL
db.setHostName("127.0.0.1");
db.setDatabaseName("testdatabase");
db.setUserName("root");
I have already set “QT_DEBUG_PLUGINS” to 1
and this is my log:
Cannot load library C:\Qt\Qt5.14.2\5.14.2\mingw73_32\plugins\sqldrivers\qsqlpsql.dll: 找不到指定的模块。
QLibraryPrivate::loadPlugin failed on "C:/Qt/Qt5.14.2/5.14.2/mingw73_32/plugins/sqldrivers/qsqlpsql.dll" : "Cannot load library C:\Qt\Qt5.14.2\5.14.2\mingw73_32\plugins\sqldrivers\qsqlpsql.dll: 找不到指定的模块
But this picture is my qt mingw dictory:

The file “qsqlpsql.dll” exists,why it fails?
This file is compiled. There is no error in the compilation.
32-bit postgresql, version 10.23
32-bit Qt 5.14.2
32-bit MinGW
My System is 64 bit Window 11 -
Please expand all dlls - I'm pretty sure libpq.dll is missing some dependencies.
-
You have to make sure that the dependencies of qsqlpsql.dll are available in the PATH (some postgresql dlls). If you don't know which dependencies are needed you can use a dependency checker to find it out.
-
You have to make sure that the dependencies of qsqlpsql.dll are available in the PATH (some postgresql dlls). If you don't know which dependencies are needed you can use a dependency checker to find it out.
@Christian-Ehrlicher Thank you for your reply, I checked the dependencies.
this is all information. I think it is OK, 32 bit dll file so C:\WINDOWS\SysWOW64\kernel32.dll

-
@Christian-Ehrlicher Thank you for your reply, I checked the dependencies.
this is all information. I think it is OK, 32 bit dll file so C:\WINDOWS\SysWOW64\kernel32.dll

-
Please expand all dlls - I'm pretty sure libpq.dll is missing some dependencies.
-
Please expand all dlls - I'm pretty sure libpq.dll is missing some dependencies.
@Christian-Ehrlicher You are right!

The solution is to copy the relevant dll in the bin directory of pgsql installation to the bin directory of mingw
-
A Ascs has marked this topic as solved on
