Sign in to follow this  
eelke_folmer

[OSX] setting up SDL for Eclipse

Recommended Posts

I got SDL setup in Xcode but I prefer to use eclipse. It does see <SDL/SDL.h> but I can't get it working in Eclipse. I copied all the project settings from the Xcode project. It will find <SDL/SDL.h> however i keep getting a: /usr/bin/ld: Undefined symbols: _main I read somewhere that SDL creates its own main and then somehow links it to yours. I've installed the SDL + developer libraries. I included SDLmain.m + h in my project I've put under the Mac osX linker section at miscellaneous:other objects: /Library/Frameworks/SDL.framework/Versions/A/SDL and at Libraries: /Library/Frameworks/SDL.framework/Versions/A/Headers Did anyone get it up and running and could they possibly help me out? I'd appreciate it. ******************************SOLUTION************************************************** I finally figured it out how to set SDL up for eclipse its pretty easy though: Copy SDLMain.m and SDLMain.h in the directory where your SDL program resides. These come with the SDL developers package In Eclipse use the following settings: GCC C++ compiler -Directories : "/System/Library/Frameworks/SDL.framework/Versions/A/Headers" // assuming SDL is installed in /System/Library Then use the following settings under the Mac OSX C++ Linker tab - Miscellanous - Linker flags : -framework SDL -framework Cocoa ~*ABSOLUTE PATH TO YOUR* SDLMain.m [Edited by - eelke_folmer on November 30, 2006 6:49:36 PM]

Share this post


Link to post
Share on other sites
The SDLmain.m file will create its own 'main' function and then pass control to yours. You have to create your own function named 'main', which should take over once the Carbon application loads.

I haven't tried to make an SDL application in Eclipse before, but you do have to make a standard Mac application that uses SDLmain.m and its nib files as that's the bit of code that passes off to your main function. I'm not really sure how to include nib files from the command line (I suspect that it may involve a Rez step).

I'd make sure that you're linking with the framework (-framework SDL) instead of linking directly to the dylibs, and also asking on the SDL or mac-games-dev mailing list.

Share this post


Link to post
Share on other sites
I think i've narrowed it down.

I still have the undefined _main error.

It sees the SDL framework and all. I just need to include SDLMain.h / .m into my eclipse project. Any suggestions on that? In Xcode its just a checkbox and it somehow converts the cocoa files (SDLMain.h/.m) into my project but in eclipse I get thousands of "@" error (probably because it doesnt understand cocoa files. I've included the cocoa framework but it still gives errors.


[Edited by - eelke_folmer on November 30, 2006 1:07:21 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this