title: Undefined reference to WinMain@16 when using SDL
body: <p>I've been having a lot of trouble getting everything working so that I can start developing on Windows, as apposed to Linux, which is what I normally use when coding. I'm having a rather bizarre issue when trying to compile an SDL program. As soon as I include the SDL library, the program refuses to compile, giving me this error:</p>
  
  <pre><code>c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../libmingw32.a&lt;main.o&gt;: In function 'main':
  C:\MinGW\msys\1.0\src\mingwrt/../mingw/main.c:73: undefined reference to 'WinMain@16'
  collect2: ld returned 1 exist status
  </code></pre>
  
  <p>I am using MinGW on console.</p>
  
  <p>To give an example, using</p>
  
  <pre><code>gcc -o test main.c
  </code></pre>
  
  <p>This compiles fine:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argv, char **argc)
  {
      printf("Hello, world!\n");
  
      return 0;
  }
  </code></pre>
  
  <p>But as soon as I add #include (even without any SDL functions being called) I get the error mentioned above</p>
  
  <p>Using:</p>
  
  <pre><code>gcc -o test main.c -lSDL
  </code></pre>
  
  <p>This fails to compile:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #include &lt;SDL/SDL.h&gt;
  
  int main(int argv, char **argc)
  {
      printf("Hello, world!\n");
  
      return 0;
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated! I read that this was a common issue for people who forget to have a main function, but obviously that's not my issue. I also heard that WinMain is the main function used when dealing with Windows graphical programs, but that's never been an issue for me in the past when I used to develop in Windows more.</p>