title: C - Undefined Reference to WSAStartup@8'
body: <p>I am using Code::Blocks, MinGW, and Windows. Im trying to initialize the winsock so that I can work on a project. I keep getting the error <code>Undefined Reference to WSAStartup@8</code> Anyone know how to go about fixing this?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;winsock2.h&gt;
  
  #pragma comment(lib,"ws2_32.lib")
  
  int main(int argc , char *argv[]){
      WSADATA wsa;
      int output;
  
      output=WSAStartup(MAKEWORD(2,2),&amp;wsa);
      if(output != 0) {
          printf("Startup failed %d\n", output);
          return 1;
      } else {
          printf("Initialized");
          return 0;
      }
  
  }
  </code></pre>