B
Brano
Hello guys, sorry for the really dumb question, but I'm just beginner in
linux programming. I have the following code in test.c:
#include <stdio.h>
#include <libpq-fe.h>
int main() {
int do_init = 1;
PQinitSSL(do_init);
}
.... so I just want to call one function from postgres library. According
to the nm command (nm /usr/lib/libpq.a) the object (which contains
PQinitSSL() function contains also number of SSL functions e.g. BIO_free,
BIO_new_mem_buf etc. When I'm trying to compile test program with command:
gcc -o test test.c -lpq
everything is OK, but when I'm trying to compile the same code with the
libpq library in the local directory, I've got a lot of undefined
reference messages on SSL functions
cp /usr/lib/libpq.a .
gcc -o test test.c -L. -lpq
So, how it is possible, that the first command works fine and the
second not ? I'm trying to compile it with the same library in both
cases. I know, that libpq.a library does not contains libcrypto.a
library. Are in the libpq.a (and generally any other) library references
to the other libraries ? And how can I determine those references ? Is it
possible with nm command ? Many thanks for the help.
linux programming. I have the following code in test.c:
#include <stdio.h>
#include <libpq-fe.h>
int main() {
int do_init = 1;
PQinitSSL(do_init);
}
.... so I just want to call one function from postgres library. According
to the nm command (nm /usr/lib/libpq.a) the object (which contains
PQinitSSL() function contains also number of SSL functions e.g. BIO_free,
BIO_new_mem_buf etc. When I'm trying to compile test program with command:
gcc -o test test.c -lpq
everything is OK, but when I'm trying to compile the same code with the
libpq library in the local directory, I've got a lot of undefined
reference messages on SSL functions
cp /usr/lib/libpq.a .
gcc -o test test.c -L. -lpq
So, how it is possible, that the first command works fine and the
second not ? I'm trying to compile it with the same library in both
cases. I know, that libpq.a library does not contains libcrypto.a
library. Are in the libpq.a (and generally any other) library references
to the other libraries ? And how can I determine those references ? Is it
possible with nm command ? Many thanks for the help.