title: SDL Error Undefined symbols for architecture x86_64 "_SDL_main"
body: <p>I am using C++ with the SDL Cocoa and Foundation framework on my mac os x. I get the following error </p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_SDL_main", referenced from:
        -[SDLMain applicationDidFinishLaunching:] in SDLMain.o
  ld: symbol(s) not found for architecture x86_64
  </code></pre>
  
  <p>when I run the following code</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;SDL/SDL.h&gt;
  #include "SDLMain.h"
  int main(int argc, const char * argv[])
  {
      SDL_Init(SDL_INIT_EVERYTHING);
      SDL_SetVideoMode(640,480,32,SDL_DOUBLEBUF);
      SDL_Event event;
      bool isRunning = true;
      while(SDL_PollEvent(&amp;event)){
          if(event.type == SDL_QUIT){
              isRunning=false;
          }
      }
  
      SDL_Quit();
      return 0;
  }
  </code></pre>
  
  <p>I have no idea what is wrong, although it seems that when I go into the SDLMain.m file and comment out this line of code</p>
  
  <pre><code>status = SDL_main (gArgc, gArgv);
  </code></pre>
  
  <p>the program compiles with no problems. However, it doesn't work. No window opens like its supposed to. Any ideas? </p>