title: Can't link using MinGW and SDL: undefined reference to WinMain@16
body: <p>I'm not getting MinGW's g++ to successfully compile SDL programs.  Here's my sample program:</p>
  
  <pre><code>#include &lt;SDL.h&gt;
  
  int main( int argc, char* args[] )
  {  
    SDL_Init( SDL_INIT_VIDEO );
    SDL_Quit();
    return 0;
  }
  </code></pre>
  
  <p>and here's my command and error report:</p>
  
  <pre><code>C:\Users\briggs_w\Desktop\testSDL&gt;g++ test.cc -IC:\MinGW\include\SDL 
  -LC:\MinGW\lib -lSDL2 -lSDL2main -lmingw32
  
  C:\MinGW\lib/libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
  collect2.exe: error: ld returned 1 exit status
  </code></pre>
  
  <p>I copied over everything in SDL2's <code>lib\x64</code> and <code>i686-w64-mingw32\lib</code> folders to the <code>C:\MinGW\lib</code> folder.</p>
  
  <p>What's missing?  At the command line, maybe.</p>
  
  <p>I did look over two threads on similar errors:</p>
  
  <p><a href="https://stackoverflow.com/questions/18115153/undefined-reference-to-winmain16-when-using-sdl">Undefined reference to WinMain@16 when using SDL</a> -- doing this</p>
  
  <p><a href="https://stackoverflow.com/questions/32342285/undefined-reference-to-winmain16-c-sdl-2">undefined reference to WinMain@16 C++, SDL-2</a> -- no effect</p>