kgzak
kgzak

Reputation: 11

Error when trying to compile in Xcode with SDL

I am trying to compile a project with SDL in Xcode and get the error:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     -u command line option

I have the SDL.framework include along with Cocoa.framework in the Link Binary with Libraries. I also have SDLMain.h and SDLMain.m in the project.

This is all my code:

#include "SDLMain.h"
#include <SDL/SDL.h>

int main(int argc, const char * argv[])
{
    return 0;
}

Upvotes: 0

Views: 159

Answers (2)

Michael Dorner
Michael Dorner

Reputation: 20125

It tool a quite long time until I got SDL and Xcode running. So, don't care. :-)

I uploaded here a simple SDL template for Xcode 4.5 and Mac OS X 10.7 and 10.8 (also using OpenGL 3.2 Core Profile possible). Step by Step instructions:

  1. Download SDL (at the moment version 1.2.15)
  2. Open the downloaded .dmg file
  3. copy the SDL.framework into /Library/Frameworks/
  4. Done. You can use the Xcode template (you should see a red area): enter image description here

Further details and an image on my Blog (only german, sorry).

Upvotes: 0

kgzak
kgzak

Reputation: 11

int main has to look like this:

int main(int argc, char * argv[])
{
    return 0;
}

get rid of the const

Upvotes: 1

Related Questions