title: How do you get a minimal SDL program to compile and link in visual studio 2008 express?
body: <p>I'm trying to use SDL in C++ with Visual Studio 2008 Express. The following program compiles but does not link:</p>
  
  <pre><code>#include &lt;SDL.h&gt;
  
  int main(int argc, char *argv[])
  {
      return 0;
  }
  </code></pre>
  
  <p>The link error is:</p>
  
  <pre><code>LINK : fatal error LNK1561: entry point must be defined
  </code></pre>
  
  <p>I get this regardless of how or if I link with SDL.lib and SDLmain.lib. Defining <code>main</code> as <code>main()</code> or <code>SDL_main()</code> gives the same error, with or without <code>extern "C"</code>.</p>
  
  <p>Edit: I solved this by not including SDL.h in main.cpp - a refactoring I did independent of the problem. A similar solution would be to <code>#undef main</code> right before defining the function.</p>