trying to use libpq in Ubuntu

Started by Henri De Feraudyover 15 years ago3 messagesgeneral
Jump to latest
#1Henri De Feraudy
feraudyh@yahoo.com

Hello,
I have developed an application in C++ under Qt in Windows XP, now I would like
to port it to Ubuntu GNU/Linux.
Choosing the libraries in Windows was a piece of cake: the bottom of my Qt
qmake project file was
win32 {
LIBS += "C:\Progra~1\PostgreSQL\8.4\lib\libpq.lib"
INCLUDEPATH += "C:\Progra~1\PostgreSQL\8.4\include"
}
linux-g++ {
LIBS += /usr/lib/libpq.a
INCLUDEPATH += /usr/include/postgresql
}

This works fine in Windows, but in Ubuntu there are more than a hundred
undefined symbols, like references to ldap
Does anyone have a sample project file or suggestions?

Thankyou
Henri

#2Daniel Verite
daniel@manitou-mail.org
In reply to: Henri De Feraudy (#1)
Re: trying to use libpq in Ubuntu

Henri De Feraudy wrote:

linux-g++ {
LIBS += /usr/lib/libpq.a
INCLUDEPATH += /usr/include/postgresql
}

Try:

linux-g++ {
LIBS += -lpq
INCLUDEPATH += /usr/include/postgresql
}

Also make sure that you have the libpq-dev package installed.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org

#3Joshua J. Kugler
joshua@eeinternet.com
In reply to: Henri De Feraudy (#1)
Re: trying to use libpq in Ubuntu

On Tuesday 21 September 2010, Henri De Feraudy elucidated thus:

Hello,
I have developed an application in C++ under Qt in Windows XP, now I
would like to port it to Ubuntu GNU/Linux.
Choosing the libraries in Windows was a piece of cake: the bottom of
my Qt qmake project file was
win32 {
LIBS += "C:\Progra~1\PostgreSQL\8.4\lib\libpq.lib"
INCLUDEPATH += "C:\Progra~1\PostgreSQL\8.4\include"
}
linux-g++ {
LIBS += /usr/lib/libpq.a
INCLUDEPATH += /usr/include/postgresql
}

This works fine in Windows, but in Ubuntu there are more than a
hundred undefined symbols, like references to ldap
Does anyone have a sample project file or suggestions?

If you are using Qt, why not use the Qt database abstraction classes?
That will save you having to compile directly against the Pg libraries.

j

--
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com - Fairbanks, AK
PGP Key: http://pgp.mit.edu/ �ID 0x73B13B6A