Question

I have a C code that uses libpq-fe.h for connecting into a postgresql database. Locally it runs well and everything but now we are trying to use it in a QT existing project. Why not using the qpsql driver instead? Well, the program itself is in plain c++ but we just use QT as an extra help for programmiing so the question is... How can I tell QT to link the code with the header against the libpq-fe.h? We tried adding the path like LIBS += -I/usr/include/postgresql and LIBS += -lpq but without results... We also tried adding the CPPFLAGS to the makefile as the documentations says but when recompiling, the program recreates the makefile so it's no use Suggestions?

Was it helpful?

Solution

Try this.

INCLUDEPATH += -I"/usr/include/postgres"
LIBS += -L"[directory to postgres library files]" -lpq
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top