sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11)
-
Hello,
I would like to use the native PostgreSQL driver in Qt.
My system is:
Win 10 x64
Qt5.11.2
MSVC2017 x64
PostgresSQL 9.6, PostgreSQL 11, both installed with the EnterpriseDB installer in the x64 versionIn general, I would like to use PostgreSQL 11, but as I could not manage to build the driver I thought it might be because of the version and tried it with 9.6 too.
Sadly it also failed.What did I do:
cd C:\Qt2\5.11.2\Src\qtbase\src\plugins\sqldrivers //Navigate to driver folder C:\Qt2\5.11.2\msvc2017_64\bin\qmake “INCLUDEPATH+=C:/Program Files/PostgreSQL/9.6/include” “LIBS+=C:/Program Files/PostgreSQL/9.6/lib/libpq.lib” sqldrivers.pro //Run QMake //Result: PostgreSQL is not detected
I was not sure whether I should use "/" or "\" for the "INCLUDEPATH" and the "LIBS".
So I tried both and nothing changed.
PostgreSQL is not detected.I have no clue with which compiler PostgreSQL was built, but if I understood the documentation right it was MSVC x64.
The version I do not know.
So do I need to build PostgreSQL myself?It also seems that others have the same problem:
Another ThreadSadly the thread is unsolved and I could not find a solution for me.
I would be really nice if you could help me.
Thank you very much!
-
Try to move the include and libs path to another folder without spaces.
-
@Christian-Ehrlicher said in sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11):
Try to move the include and libs path to another folder without spaces.
I tried it for both versions and is still not recognizing PostgreSQL.
-
According to the documentation you pass the wrong parameters to qmake: http://doc.qt.io/qt-5/sql-driver.html#qpsql
-
@Christian-Ehrlicher said in sqldrivers: PostgreSQL not found (Win10, Qt5.11.2, MSVC2017, Postgres 9.6 and 11):
According to the documentation you pass the wrong parameters to qmake: http://doc.qt.io/qt-5/sql-driver.html#qpsql
You are right.
I found the wrong arguments somewhere else.psql is included in the source code of PostgreSQL.
So it seems to be necessary to download the source code.
The lib folder namend in the documentation is not there.
I assume I would need to build PostgreSQL myself to generate it.In between I got the ODBC-Connector working.
So I think it is easier using that one than compiling PostgreSQL from source.
This is what I will do now.Thanks for the help :-)
-
You don't need to build postgresql by yourself. The lib and include folder should be there when you install psql server - maybe you forgot to install the devel packages (don't remember what I really installed in postgres) or sth. similar.
-
Thanks,
I tried it without success.
For me it seems the documentation is not up to date as the named folder sturcture is not existing in the EnterpriseDB installer installed version or in the official sources.
I also looked whether there is something like an extra psql module to download, but have not found anything.