postgresql problem linking libpq with c program using gcc 12.04
Asked by
Philippe Van Schendel
This code does not link with libpq: i have undefined reference to 'PQconnectdb'
i do: gcc -I /usr/include/
libpq.a is in /usr/lib directory size 301928, i have a brand new 12.04 (64 bits) system with postgres 9.1, i have installed package libpq-dev
when i do 'nm libpq.a' i can see PQconnectdb symbols, the linker do not see the PDconnectdb symbol in libpq.a
i dont understand the problem.. no clue. is it 32/64 bits problem, c/c++ name mangling ?
Source code here:
#include "libpq-fe.h"
int main(int argc, char *argv[])
{
PGconn *pgConn = PQconnectdb(
if (pgConn != NULL)
{
printf("Connected to database.\n");
}
else
{
printf("Cannot connect to database.\n");
}
}
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Ubfan
- Solved:
- Last query:
- Last reply:
To post a message you must log in.