libssh2 on CodeLite

General questions regarding the usage of CodeLite
CodeLite Curious
Posts: 1
Joined: Tue May 05, 2020 12:31 am
Genuine User: Yes
IDE Question: C++

libssh2 on CodeLite

Post by Blai » Tue May 05, 2020 12:37 am


I'm pretty new to CodeLite and programming in general.

I installed CodeLite on a Windows 10 machine. Made a sample console program, working.

Now I would like to create a C program that uses libssh2 library ( to connect to a Linux box and execute some commands.

I wanted to use this file:

so I imported the files inside the src and include directories of libssh2 into my project.

Unfortunately, the program crashes on building with several errors like:

Code: Select all

C:/Users/admin/Documents/Documents/Printers_terminal/src/crypto.h:222:26: error: unknown type name '_libssh2_cipher_ctx'
  222 | int _libssh2_cipher_init(_libssh2_cipher_ctx * h,
      |                          ^~~~~~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/crypto.h:223:26: error: unknown type name '_libssh2_cipher_type'
  223 |                          _libssh2_cipher_type(algo),
      |                          ^~~~~~~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/crypto.h:227:27: error: unknown type name '_libssh2_cipher_ctx'
  227 | int _libssh2_cipher_crypt(_libssh2_cipher_ctx * ctx,
      |                           ^~~~~~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/crypto.h:228:27: error: unknown type name '_libssh2_cipher_type'
  228 |                           _libssh2_cipher_type(algo),
      |                           ^~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/admin/Documents/Documents/Printers_terminal/src/wincng.c:39:
C:/Users/admin/Documents/Documents/Printers_terminal/src/libssh2_priv.h:166:28: error: 'SHA512_DIGEST_LENGTH' undeclared here (not in a function)
      |                            ^~~~~~~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/libssh2_priv.h:166:28: note: in definition of macro 'MAX_SHA_DIGEST_LEN'
      |                            ^~~~~~~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/libssh2_priv.h:259:5: error: unknown type name '_libssh2_bn_ctx'
  259 |     _libssh2_bn_ctx *ctx;
      |     ^~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/libssh2_priv.h:260:5: error: unknown type name '_libssh2_dh_ctx'
  260 |     _libssh2_dh_ctx x;
      |     ^~~~~~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/libssh2_priv.h:261:5: error: unknown type name '_libssh2_bn'
  261 |     _libssh2_bn *e;
      |     ^~~~~~~~~~~
C:/Users/admin/Documents/Documents/Printers_terminal/src/libssh2_priv.h:262:5: error: unknown type name '_libssh2_bn'
  262 |     _libssh2_bn *f;
Any help would be appreciated on how to use this library on my project

Thanks in advance
Last edited by DavidGH on Tue May 05, 2020 12:55 pm, edited 1 time in total.
Reason: Added code-tags

User avatar
CodeLite Plugin
Posts: 6091
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++

Re: libssh2 on CodeLite

Post by eranif » Thu May 07, 2020 12:07 pm

You don't need to import them. You need to let the compiler the location of the headers of this library + where it can find the library itself during link
You should download a prebuilt binary and use that
Make sure you have read the HOW TO POST thread

Post Reply