title: Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' on Visual Studio 2010 C ++?
body: <p>I get the following error <code>Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt'</code> when I compile my code using Win32 Console Application.
  I tried fixing it my going into Projects -> Properties -> General -> Linker -> Enable Incremental Linking and I changed it from "Yes" to No (/INCREMENTAL:NO) and then I tried to debug my code again but got another error message :</p>
  
  <pre><code>1&gt;------ Build started: Project: Someproject, Configuration: Debug Win32 ------
  1&gt;project1.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
  1&gt;MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
  1&gt;c:\users\anne\documents\visual studio 2010\Projects\Someproject\Debug\Someproject.exe : fatal error LNK1120: 1 unresolved externals
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>How can I fix it?</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  #include &lt;process.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  volatile int counter = 0;
  
  int isPrime(int n)
  {
      for(int i = 2; i &lt; (int)(sqrt((float)n) + 1.0) ; i++) {
          if (n % i == 0) return 0;
      }
      return 1;
  }
  
  unsigned int __stdcall mythread(void*) 
  {
      char* s;
      while (counter &lt; 25) {
          int number = counter++;
          s = "No";
          if(isPrime(number)) s = "Yes";
          printf("Thread %d value = %d is prime = %s\n",
              GetCurrentThreadId(), number, s);
      }
      return 0;
  }
  
  int main(int argc, char* argv[])
  {
      HANDLE myhandleA, myhandleB;
      myhandleA = (HANDLE)_beginthreadex(0, 0, &amp;mythread, (void*)0, 0, 0);
      myhandleB = (HANDLE)_beginthreadex(0, 0, &amp;mythread, (void*)0, 0, 0);
  
      WaitForSingleObject(myhandleA, INFINITE);
      WaitForSingleObject(myhandleB, INFINITE);
  
      CloseHandle(myhandleA);
      CloseHandle(myhandleB);
  
      getchar();
  
      system("pause");
      return 0;
  } 
  </code></pre>