title: Visual Studio Code "undefined reference to `WinMain@16'"
body: <p>so I am trying to make a Windows Desktop Application with c++ in Visual Studio Code and using MinGW as my compiler.
  I have a file called <em>test.cpp</em> in a folder called <em>src</em>:</p>
  
  <pre><code>#ifndef UNICODE
  #define UNICODE
  #endif 
  #include &lt;windows.h&gt;
  
  int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, 
  int nCmdShow){
  
    const wchar_t name[] = L"Test";
  
    WNDCLASS wc = {};
    //wc.lpfnWndProc = WindowProc;
    wc.hInstance = hInstance;
    wc.lpszClassName = name;
  
    RegisterClass(&amp;wc);
  
    HWND hWnd = CreateWindowEx(
      0, 
      name, 
      L"Window", 
      WS_BORDER, 
      CW_USEDEFAULT, 
      CW_USEDEFAULT, 
      1200, 
      720, 
      0, 
      0, 
      hInstance, 
      0);
  
    if(hWnd == NULL){
      return 0;
    }
  
    ShowWindow(hWnd, nCmdShow);
  }
  </code></pre>
  
  <p>But when I compile I get this error:</p>
  
  <pre><code>&gt; Executing task: g++ -g test.cpp -o test.exe &lt;
  
  c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
  collect2.exe: error: ld returned 1 exit status
  The terminal process terminated with exit code: 1
  </code></pre>
  
  <p>I also have a <em>tasks.json</em> and a <em>launch.json</em> in <em>.vscode folder</em>:</p>
  
  <p><strong>tasks.json</strong></p>
  
  <pre><code>"version": "2.0.0",
  "tasks": [
    {
      "label": "test",
      "type": "shell",
      "command": "g++",
      "options": {
        "cwd": "${workspaceFolder}/src"
      },
      "args": [
        "-g", "test.cpp", "-o", "test.exe"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
  </code></pre>
  
  <p><strong>Launch.json</strong></p>
  
  <pre><code>"version": "0.2.0",
    "configurations": [
    {
      "name": "(Windows) Launch",
      "type": "cppvsdbg",
      "request": "launch",
      "program": "${workspaceFolder}/src/test.exe",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}/src",
      "environment": [],
      "externalConsole": true,
      "preLaunchTask": "test"
    }
  ]
  </code></pre>
  
  <p>The problem is that when I build a file with a <em>main</em> function it compiles fine, but when it is done with <em>wWinMain</em> that error happens and I don't know how to fix it. I'll really appreciate if someone can help me with this.</p>