how to format the question properly...please help................I am trying to write a SSH program using libssh library. I am at beginner level in C language.
Code:
#include #include #include int main() { ssh_session my_ssh_session = ssh_new();\n if (my_ssh_session == NULL) exit(-1); printf("done!"); ssh_free(my_ssh_session); }
And on compiling, this is the error that i got,
Code:
ubuntu@ubuntu:~/Desktop/SSH$ gcc -o test test.c /tmp/ccw8Zq99.o: In function `main': test.c:(.text+0x9): undefined reference to `ssh_new' test.c:(.text+0x39): undefined reference to `ssh_free' collect2: error: ld returned 1 exit status
On googling a little, i come across this link, so..
Code:
ubuntu@ubuntu:~/Desktop/SSH$ gcc -lssh -o test test.c /usr/bin/ld: cannot find -lssh collect2: error: ld returned 1 exit status
I think i have made some mistake while adding libssh.h header file. this is what i have done is 1. install tar file from official website 2. extract it 3. copy libssh/ folder present in include folder to /usr/include. That's it. Is this the correct way to add a header file? Any kind of help/sugestion is appreciated. Thank you. Can somebody please tell me how to format the question?