I have built a simple program in Visual Studio, as per the below.
#define LIBSSH_STATIC 1
#include <libssh/libssh.h>
#include <iostream>
#include <stdlib.h>
int main()
{
std::cout << "Hello World!\n";
ssh_session my_ssh_session;
int verbosity = SSH_LOG_PROTOCOL;
int port = 22;
my_ssh_session = ssh_new();
if (my_ssh_session == NULL)
exit(-1);
ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "10.10.10.100");
ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
ssh_free(my_ssh_session);
}
For the Lisssh library, I have downloaded the code from here: https://github.com/ShiftMediaProject/libssh/releases
...and added the library to Visual Studio, following the instructions here How to manually add a library to a visual studio 2017 project?
The library works and the program compiles, my only issue is that in order for it to work I have to manually copy a file called ssh.dll into the folder where the program executes from.
I have tried in Visual Studio setting C/C++, Code Generation -> Multi-threaded (/MT) to statically link the library, but the DLL is not getting included.
How can I create a single executable, that includes the ssh.dll?
Thanks