title: Running C on VS code: undefined reference to `WinMain'
body: <p>This is what it looks like on VS code terminal when I run the code.</p>
  <pre><code>Windows PowerShell
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  Try the new cross-platform PowerShell https://aka.ms/pscore6
  
  PS D:\C C++&gt; cd &quot;d:\C C++\&quot; ; if ($?) { g++ TEST.C -o TEST } ; if ($?) { .\TEST }
  D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
  C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
  collect2.exe: error: ld returned 1 exit status
  PS D:\C C++&gt; 
  </code></pre>
  <p>This is the simple program I tried to run.</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  int main(){
      int age;
      printf(&quot;Enter age\n&quot;);
      scanf(&quot;%d&quot;,&amp;age);
      printf(&quot;age is %d&quot;,age);
      return 0;
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/iUPmb.png" rel="nofollow noreferrer">screenshot of the program</a></p>