Error in compiling Postgres FE C program
Hi folks,
I am a newbie to postgres FE programming. I am trying to connect to Postgres db like Code:
#include <stdio.h> gcc <My program.c> All the functions like PQconnectdb() are defined in libpq-fe.h Now my compiler is throwing error like " undefined reference to `PQconnectdb' " But this is defined in the header file.... Again I tried copying the entire header file in my program. ( All the defenitions are now in the program itself) Again it is showing the undefined reference problem.............. What could be wrong???? please help me Do I need to add any extra options while compiling? |
You need to link to the postgre libraries. Try passing the line -lpq to gcc (i.e., “gcc -lpq <My program.c>”).
Btw, your compiler is not really throwing the error, it’s the linker. |
Thanks a lot osor. It did help..
|
All times are GMT -5. The time now is 04:00 AM. |