Jump to content
  • Advertisement
Sign in to follow this  

SDL problem in xcode

This topic is 2712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've recently decided to try and learn SDL and C++. So I found this great list of tutorial at: http://www.lazyfoo.n...on01/index2.php

However, when I try to do the first lesson I type this into the main file (SDLmain.h):
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>

Feel free to customize this file to suit your needs

#import <Cocoa/Cocoa.h>
#include "SDL/SDL.h"

@interface SDLMain : NSObject

int main( int argc, char* args[] )
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;

//Start SDL

//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

//Load image
hello = SDL_LoadBMP( "/Users/Fenhopi/Downloads/hello.bmp" );

//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );

//Update Screen
SDL_Flip( screen );

SDL_Delay( 2000 );

//Free the loaded image
SDL_FreeSurface( hello );

//Quit SDL

return 0;

When I hit build and debug, I get this error:
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1

And this warning:

ld: warning: directory '/Users/Fenhopi/Library/Frameworks' following -F not found

ld: duplicate symbol _SDL_main in /Users/Fenhopi/Documents/SDL TEST/build/SDL TEST.build/Debug/SDL TEST.build/Objects-normal/i386/main.o and /Users/Fenhopi/Documents/SDL TEST/build/SDL TEST.build/Debug/SDL TEST.build/Objects-normal/i386/SDLMain.o

Any ideas/suggestions?

Thanks in advance,

Share this post

Link to post
Share on other sites
Don't touch the files SDLMain.h and SDLMain.m. Those files are needed to compile SDL code on Mac OS X. Create a file called main.cpp and add your code there.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!