Solved [MSVC 2015] QPSQL driver not loaded
-
Hi,
I'm trying connect my app to Postgres, but all time I get warning; QPSQL Driver not loaded.I did:
- installed Postgres x86,
- copied:
libeay32.dll
libiconv-2.dll
libintl-8.dll
libpq.dll
ssleay32.dll to QtRoot/ver/msvc2015/bin - I've got setted up PATH
and still nothing work.
Note:
Qt ver. 5.9.5
Compiler: MSVC 2015 32 bit
OS: Windows 7 -
@SGaist said in [MSVC 2015] QPSQL driver not loaded:
Start your application with the
QT_DEBUG_PLUGINS
environment variable set to one. That should give you some hints about what is happening.WARNING: QLibraryPrivate::loadPlugin failed on "C:/Qt/5.9.5/msvc2015/plugins/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Qt\\5.9.5\\msvc2015\\plugins\\sqldrivers\\qsqlpsqld.dll: Unknown error 0x000000c1." <plugin\qlibrary.cpp:609> WARNING: QSqlDatabase: QPSQL driver not loaded <kernel\qsqldatabase.cpp:694>
But file qsqlpsqld.dll & qsqlpsqld.pdb exist.
@mchinand said in [MSVC 2015] QPSQL driver not loaded:
Instead of copying dlls, have you tried adding your Postgres' bin directory to your path (or add it to the 'run' path for your project in QtCreator? I would avoid copying dlls to the Qt tree and would instead copy them to the location of your project's executable (but prefer modifying the path environment variable unless you're deploying it to a different computer). My installation of Postgres has more dlls in the bin directory than you listed. You could also run the Dependency Walker on your copied libpq.dll to see what it thinks is missing, if anything.
I tried fix it by https://forum.qt.io/topic/32688/qpsql-driver-not-loaded/4 , but I have to deploy it to different computer.
Dependecy Walker didn't point anything is missing.UPDATE
When I leave from IDE Windows pointed error with urctbase.dll, so:
- use cmd for MSVC 2015
windeployqt app.exe --release --pdb
- copy all dll from Postgres/version/bin into exe file
- copy ucrtbase.dll from Windows Kits/10/Redist/ucrt/DLLs/ (arm || x64 || x86 ) into exe file.
Now I can run app from IDE, but when I try run app from cmd I get the same error with urctbase.dll
I had mistake in parameter. All fixed. - use cmd for MSVC 2015
-
Hi,
Start your application with the
QT_DEBUG_PLUGINS
environment variable set to one. That should give you some hints about what is happening. -
Instead of copying dlls, have you tried adding your Postgres' bin directory to your path (or add it to the 'run' path for your project in QtCreator? I would avoid copying dlls to the Qt tree and would instead copy them to the location of your project's executable (but prefer modifying the path environment variable unless you're deploying it to a different computer). My installation of Postgres has more dlls in the bin directory than you listed. You could also run the Dependency Walker on your copied libpq.dll to see what it thinks is missing, if anything.
-
@SGaist said in [MSVC 2015] QPSQL driver not loaded:
Start your application with the
QT_DEBUG_PLUGINS
environment variable set to one. That should give you some hints about what is happening.WARNING: QLibraryPrivate::loadPlugin failed on "C:/Qt/5.9.5/msvc2015/plugins/sqldrivers/qsqlpsqld.dll" : "Cannot load library C:\\Qt\\5.9.5\\msvc2015\\plugins\\sqldrivers\\qsqlpsqld.dll: Unknown error 0x000000c1." <plugin\qlibrary.cpp:609> WARNING: QSqlDatabase: QPSQL driver not loaded <kernel\qsqldatabase.cpp:694>
But file qsqlpsqld.dll & qsqlpsqld.pdb exist.
@mchinand said in [MSVC 2015] QPSQL driver not loaded:
Instead of copying dlls, have you tried adding your Postgres' bin directory to your path (or add it to the 'run' path for your project in QtCreator? I would avoid copying dlls to the Qt tree and would instead copy them to the location of your project's executable (but prefer modifying the path environment variable unless you're deploying it to a different computer). My installation of Postgres has more dlls in the bin directory than you listed. You could also run the Dependency Walker on your copied libpq.dll to see what it thinks is missing, if anything.
I tried fix it by https://forum.qt.io/topic/32688/qpsql-driver-not-loaded/4 , but I have to deploy it to different computer.
Dependecy Walker didn't point anything is missing.UPDATE
When I leave from IDE Windows pointed error with urctbase.dll, so:
- use cmd for MSVC 2015
windeployqt app.exe --release --pdb
- copy all dll from Postgres/version/bin into exe file
- copy ucrtbase.dll from Windows Kits/10/Redist/ucrt/DLLs/ (arm || x64 || x86 ) into exe file.
Now I can run app from IDE, but when I try run app from cmd I get the same error with urctbase.dll
I had mistake in parameter. All fixed. - use cmd for MSVC 2015