title: problem with socket programming in c\c++
body: <pre><code>#include "stdafx.h"
  #include &lt;windows.h&gt;
  #include &lt;winsock.h&gt;
  #include &lt;stdio.h&gt;
  
  int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR IpCmdLine,int nCmdShow)
  {
      WSADATA ws;
      char buf[100];
  
      WSAStartup(0x0101,&amp;ws);
  
      sprintf(buf,"%d.%d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion));
      MessageBox(0,buf,"info",0);
      WSACleanup();
      return 0;
  }
  </code></pre>
  
  <p>This program is for getting information of available wsock version in the computer.
  I cannot understand why "stdafx.h" is included in program.
  What's the significance of APIENTRY? Can't we use _stdcall instead?
  I also can't compile it in VC++. What's the problem with the code?</p>
  
  <p>Below are the errors when executing program there are no errors during compiling.</p>
  
  <pre><code>--------------------Configuration: sa - Win32 Debug--------------------
  Linking...
  sa.obj : error LNK2001: unresolved external symbol _WSACleanup@0
  sa.obj : error LNK2001: unresolved external symbol _WSAStartup@8
  LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
  Debug/sa.exe : fatal error LNK1120: 3 unresolved externals
  Error executing link.exe.
  
  sa.exe - 4 error(s), 0 warning(s)
  </code></pre>