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?
Asked
Active
Viewed 1,899 times
1

Edgar Sampere
- 263
- 4
- 24
-
You don't need to add directories under `/usr/include` at pro file. What is your problem? Did it fail to build or did not find any header? Please be specific. Post some code. – Md. Minhazul Haque Apr 05 '13 at 20:17
-
My code has the header `#include
` and I'm using Qt but when I try to build it fails reporting this problem : `libpq-fe.h: No such file or directory` and that's because, when you build code with libpq library, you need tu compile against it using `I/usr/include/postgresql -L/usr/lib -lpq` wherever your libpq header may be. – Edgar Sampere Apr 11 '13 at 18:28
1 Answers
2
Try this.
INCLUDEPATH += -I"/usr/include/postgres"
LIBS += -L"[directory to postgres library files]" -lpq

Jon Fast
- 171
- 6