Is that underscore that makes the linker can't find the real symbol PQconnectdb? Why the compiler add an underscore to the symbol?
This is the __cdecl
convention that is still in effect for x86 (32 bits) but has been obsoleted for 64 bits builds.
Since dumpbin libpq.lib /exports
shows no underscores, it means that this library comes from a 64 bits build.
To produce a 32 bits program, replace your libraries with the lib
directory from a 32 bits PostgreSQL zip archive. The contents will be compatible with your current build configuration that appears to be 32 bits.
On the other hand, to produce a 64 bits program, configure Qt Creator to use a 64 bits "Kit" (e.g. in Qt Creator 3, Projects
tab, see Add Kit
in the Build & Run
panel) with the 64 bits PostgreSQL libraries you already have.