link libssh with static library (libssh.a)
link libssh with static library (libssh.a) I was trying to link my program with libssh static library. Following is my simple code copied from libssh tutorial: //sshtest.c #define LIBSSH_STATIC 1 #include <libssh/libssh.h> #include <stdlib.h> int main() { ssh_session my_ssh_session; my_ssh_session = ssh_new(); if (my_ssh_session == NULL) exit(-1); ssh_free(my_ssh_session); } I put library file libssh.a into the subdirectory libs/ libssh.a libs/ Then compile it with command gcc sshtest.c -Llibs -lssh -o sshtest gcc sshtest.c -Llibs -lssh -o sshtest The output is bunch of undefined reference errors like: libs/libssh.a(wrapper.c.o): In function `crypto_free': /home/gg/libssh/src/wrapper.c:156: undefined reference to `BN_clear_free' /home/gg/libssh/src/wrapper.c:157: undefined reference to `BN_clear_free' libs/libssh.a(libcrypto.c.o): In function `ssh_reseed': /home/gg/libssh/src/libcrypto.c:77: undefined reference to `RAND_add' libs/libssh.a(li...
