title: undefined reference to c header file's
body: <p>I want to make a library for testing and for this purpose, I wanna make a c program just returning some <code>char*</code>. I have built it based on <code>cmake</code>. this is my cmake file:</p>
  <pre><code>cmake_minimum_required(VERSION 2.8)
  project(smc)
  add_executable(${PROJECT_NAME} &quot;main.c&quot; &quot;info.cpp&quot;)
  target_link_libraries(${PROJECT_NAME}
      -lssh
      )
  set(HDRS
      ${NMEA_HDRS}
      info.h
      )
  </code></pre>
  <p>header:</p>
  <pre><code>#ifndef INFO_H
  #define INFO_H
  
  int sshConnection();
  char* getcpuusage();
  
  #endif // INFO_H
  </code></pre>
  <p>source:</p>
  <pre><code>#include &quot;info.h&quot;
  #include &lt;libssh/libssh.h&gt;
  #include &lt;stdio.h&gt;
  int sshConnection()
  {
      ssh_session my_ssh_session = ssh_new();
      const void* ip = &quot;localhost&quot;;
      if( my_ssh_session == NULL ) {
              printf( &quot;Error creating ssh session&quot; );
              return 1;
      }
      ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, &quot;localhost&quot;);
      ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, &quot;heydari.f&quot;);
      int rc = ssh_connect(my_ssh_session);
      if( rc != SSH_OK ) {
              printf(&quot;Error with connecting&quot; );
              ssh_free(my_ssh_session);
              return -1;
      }
  
      rc = ssh_userauth_password(my_ssh_session, NULL, &quot;heydari@linux&quot;);
      if( rc != SSH_AUTH_SUCCESS) {
              printf(&quot;Error with authorization %c &quot; , ssh_get_error(my_ssh_session) );
              ssh_disconnect(my_ssh_session);
              ssh_free(my_ssh_session);
              return -1;
      }
  
  }
  char *getcpuusage()
  {
      sshConnection();
      char * usage = &quot;44%&quot;;
      return usage;
  }
  
  </code></pre>
  <p>when I use this header file in my main.cpp:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &quot;info.h&quot;
  int main()
  {
      char* f = getcpuusage();
      return 0;
  }
  </code></pre>
  <p>I got this error:</p>
  <pre><code>.../projects/smc/smc/main.c:-1: error: undefined reference to `getcpuusage'
  </code></pre>
  <p>am I wrong in making cmake?</p>