title: Instead of linking with lws2_32 , which library is missing?
body: <p>I am begining with socket programing and I am able to compile my program correctly without any error i.e the command</p>
  
  <pre><code>gcc -c file_name.c
  </code></pre>
  
  <p>gives no error but when I try to link it with libraries and try to create an executable file for running my code i.e by</p>
  
  <pre><code>gcc file_namme.o -o file_name -lws2_32
  </code></pre>
  
  <p>it throws an error of undefined reference to inet_pton , I want to know which linking library I am missing and why this error is there</p>
  
  <p>My code is as follows</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdint.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;string.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;winsock2.h&gt;
  #include&lt;windows.h&gt;
  #include&lt;ws2tcpip.h&gt;
  #define WIN32_LEAN_AND_MEAN
  #pragma comment(lib, "Ws2_32.lib")
  WSADATA wsaData;
  void diewithusermsg(const char* msg , const char* detail);
  void diewithsysmsg(const char* msg);
  int main(int argc,char* argv[])
   {
  
  if(argc&lt;3 || argc&gt;4)
  {
      diewithusermsg("Parameters","&lt;server address&gt; &lt;Echo String&gt; &lt;port      number&gt;");
  }
  char* servip=argv[1];
  char* echostring=argv[2];
   uint16_t servport=(argc==4)?atoi(argv[3]):7;
   int sock = socket(AF_INET, SOCK_STREAM , IPPROTO_TCP);
      if(sock&lt;0){
          diewithsysmsg("socket() failed");
      }
      struct sockaddr_in servAddr;
      memset(&amp;servAddr,0,sizeof(servAddr));
      servAddr.sin_family=AF_INET;
      int rtnVal = inet_pton(AF_INET,servip,&amp;servAddr.sin_addr.S_un);
  }
  void diewithusermsg(const char* msg, const char* detail)
  {
  fputs(msg,stderr);
  fputs(":",stderr);
  fputs(detail,stderr);
  fputs("\n",stderr);
  exit(1);
  }
  void diewithsysmsg(const char*msg)
  {perror(msg);
  exit(1);
  }
  </code></pre>