title: How to properly include libssh in C
body: <p>I am getting an error every time I try to compile my code with gcc on Ubuntu.</p>
  
  <p>I installed libssh-dev by typing:</p>
  
  <pre><code>sudo apt-get install libssh-dev
  </code></pre>
  
  <p>and it installed just fine (No error messages)</p>
  
  <p>The code I am trying to compile is:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #define LIBSSH_STATIC 1
  #include &lt;libssh/libssh.h&gt;
  
  int main(void){
      int rc;
      int port = 21;
      char *pass = "password";
  
      ssh_session my_ssh_session = ssh_new();
      if(my_ssh_session == NULL){
          exit(-1);
      }
  
      ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "localhost");
      ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &amp;port);
      ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, "username");
  
      rc = ssh_connect(my_ssh_session);
      if(rc != SSH_OK){
          fprintf(stderr, "Error connecting to localhost: %s\n", ssh_get_error(my_ssh_session) );
          exit(-1);
      } 
  
      ssh_userauth_password(my_ssh_session, NULL, pass);
  
      ssh_disconnect(my_ssh_session);
      ssh_free(my_ssh_session);
  }
  
  </code></pre>
  
  <p>When I try to compile the code the error message says:</p>
  
  <pre><code>user@neodym:~/Desktop/projects/ssh$ gcc -lssh ssh_client.c 
  /tmp/ccGihId0.o: In function `main':
  ssh_client.c:(.text+0x2a): undefined reference to `ssh_new'
  ssh_client.c:(.text+0x57): undefined reference to `ssh_options_set'
  ssh_client.c:(.text+0x6c): undefined reference to `ssh_options_set'
  ssh_client.c:(.text+0x84): undefined reference to `ssh_options_set'
  ssh_client.c:(.text+0x90): undefined reference to `ssh_connect'
  ssh_client.c:(.text+0xa5): undefined reference to `ssh_get_error'
  ssh_client.c:(.text+0xe2): undefined reference to `ssh_userauth_password'
  ssh_client.c:(.text+0xee): undefined reference to `ssh_disconnect'
  ssh_client.c:(.text+0xfa): undefined reference to `ssh_free'
  collect2: error: ld returned 1 exit status
  
  </code></pre>
  
  <p>I all ready googled but nothing has worked so far.</p>
  
  <p>The libssh header files are getting installed at <em>/usr/include/libssh/</em> so gcc should be able to find those.</p>
  
  <p>Can you help me to fix this?</p>