Qt Postgres 'driver not loaded'

282 Views Asked by At

I use Windows 10 and Qt version 4.8.6 (msvc).

I try to connect to my postgres database but I always got the error 'driver not loaded'. I copied libpq.dll to the path of the executable and in the directory plugins, which I copied under the executable path.

This is my code:

dbPhilo.setHostName("127.0.0.1"); 
dbPhilo.setPort(5433);
dbPhilo.setDatabaseName("postgres"); 
dbPhilo.setUserName("postgres");
dbPhilo.setPassword("toor");

if(dbPhilo.open())
...

In the documentation, this line doesn't work:

qmake -- PSQL_INCDIR=C:/psql/include PSQL_LIBDIR=C:/psql/lib/ms

It shows me the documentation of qmake.

Is there a way to download the correct dll from a website ?

Thank you for your help.

0

There are 0 best solutions below