Jump to content
  • Advertisement
Sign in to follow this  
eelke_folmer

[OSX] setting up SDL for Eclipse

This topic is 4248 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

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
Advertisement
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
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!