title: Setting up SDL on Mac OS X Lion with Xcode 4
body: <p>I've been trying to get a super simple SDL program to work. I'm using Mac OS X Lion. I've got SDL to work in Snow Leopard, but it doesn't seem to want to work in lion. So far I have this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "SDL/SDL.h"
  
  using namespace std;
  
  /*
  #ifdef main
  #  undef main
  #endif
  */
  
  int main( int argc, char* args[] )
  {
      SDL_Surface* hello = NULL;
      SDL_Surface* screen = NULL;
      SDL_Init( SDL_INIT_EVERYTHING );
      screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
      hello = SDL_LoadBMP( "hello.bmp" );
      SDL_BlitSurface( hello, NULL, screen, NULL );
      SDL_Flip( screen );
      SDL_Delay( 2000 );
      SDL_FreeSurface( hello );
      SDL_Quit();
  
      return 0;
  }
  </code></pre>
  
  <p>When I try to compile this code (in Xcode 4.1) it gives me this error:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_main", referenced from:
        start in crt1.10.6.o
       (maybe you meant: _SDL_main)
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>If I uncomment the #ifdef stuff I have commented currently, the program compiles, but then receives SIGABRT on the SDL_SetVideoMode line. That commented stuff I have I just saw in another program, I'm not sure if I'm supposed to have it or not.</p>
  
  <p>How am I supposed to get this working?</p>