Hack Forums
[C] Error when compiling for libssh. - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Error when compiling for libssh. (/showthread.php?tid=5547059)



Error when compiling for libssh. - Karma18 - Feb 9, 2017

Hello hackforums, just reaching out to see if any experienced c coders could help me with this. I'm trying to compile with libssh and i'm receiving these errors.

Code
prg.c:23:11: error: unknown type name ‘SSH_SESSION’
int shell(SSH_SESSION* session)
           ^
prg.c: In function ‘checkauth’:
prg.c:54:5: error: unknown type name ‘SSH_SESSION’
     SSH_SESSION* session;
     ^
prg.c:55:5: error: unknown type name ‘SSH_OPTIONS’
     SSH_OPTIONS* options;
     ^
prg.c:67:59: error: ‘AUTH_SUCCESS’ undeclared (first use in this function)
     if (ssh_userauth_password(session, NULL, password) != AUTH_SUCCESS) {
                                                           ^
prg.c:67:59: note: each undeclared identifier is reported only once for each function it appears in



* - Annabelle Lee - Feb 9, 2017

How are you trying to compile? And can you post libssh?


* - Karma18 - Feb 9, 2017

(Feb 9, 2017 06:53 AM)Annabelle Lee Wrote:  How are you trying to compile? And can you post libssh?

/* cp /usr/local/lib/libssh.so /usr/lib/
gcc -o update prg.c -I /usr/local/include -L /usr/local/lib/ -lssh -lpthread

*/


* - g4143 - Feb 9, 2017

I just checked out their linking page its pretty straight forward.

http://api.libssh.org/stable/libssh_linking.html


* - Annabelle Lee - Feb 9, 2017

(Feb 9, 2017 07:43 AM)g4143 Wrote:  I just checked out their linking page its pretty straight forward.

http://api.libssh.org/stable/libssh_linking.html

Yeah, too bad that helps almost zero amount.


* - g4143 - Feb 9, 2017

Has anyone tried searching Stack OverFlow for the answer?

http://stackoverflow.com/questions/32094511/how-to-include-libssh-to-my-project


* - Annabelle Lee - Feb 9, 2017

(Feb 9, 2017 08:59 AM)g4143 Wrote:  Has anyone tried searching Stack OverFlow for the answer?

http://stackoverflow.com/questions/32094511/how-to-include-libssh-to-my-project

Again this doesn't work. What I figured out is that the program is written for an older version of libssh and you need to change around some of the definitions/function calls to their updated versions. Hence it throws around errors. So far I got most of them gone, except for one, which I'm currently fixing.


* - g4143 - Feb 9, 2017

(Feb 9, 2017 09:01 AM)Annabelle Lee Wrote:  Again this doesn't work. What I figured out is that the program is written for an older version of libssh and you need to change around some of the definitions/function calls to their updated versions. Hence it throws around errors. So far I got most of them gone, except for one, which I'm currently fixing.
You seem to be working with more information than OP posted.


* - Annabelle Lee - Feb 9, 2017

(Feb 9, 2017 10:50 AM)g4143 Wrote:  You seem to be working with more information than OP posted.

He PMed me on discord asking for help, hence I guess.