Jump to content
  • Advertisement
Sign in to follow this  
CaptNeo

SDL, eclipse & MacOS X

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

Hello, currently I'm trying to compile a simple SDL sample with eclipse on a Mac (OS X Leopard). I followed the guide on http://meandmarkpublishing.blogspot.com/2006/12/setting-up-sdl-for-eclipse-on-mac-os-x.html to the best of my knowledge. I'm a Mac noob still so I can't be sure, I missunderstood something. I'm getting errors about the sdl/sdl.h not being where it is supposed to be, though I added the include path for the framework. make all Building file: ../src/SDL_OpenGL_test.cpp Invoking: GCC C++ Compiler g++ -I/Network/Servers/coleman.informatik.RWTH-Aachen.DE/Volumes/RAID2/Hiwis/kurtz/Library/Frameworks/SDL.framework/Versions/A/Headers -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/SDL_OpenGL_test.d" -MT"src/SDL_OpenGL_test.d" -o"src/SDL_OpenGL_test.o" "../src/SDL_OpenGL_test.cpp" Finished building: ../src/SDL_OpenGL_test.cpp Building target: SDL_OpenGL_test Invoking: MacOS X C++ Linker g++ -framework Cocoa -framework SDL /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m -o "SDL_OpenGL_test" ./src/SDL_OpenGL_test.o /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:8:21: error: SDL/SDL.h: No such file or directory /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m: In function '-[SDLApplication terminate:]': /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:75: error: 'SDL_Event' undeclared (first use in this function) /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:75: error: (Each undeclared identifier is reported only once /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:75: error: for each function it appears in.) /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:75: error: syntax error before 'event' /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:76: error: 'event' undeclared (first use in this function) /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:76: error: 'SDL_QUIT' undeclared (first use in this function) make: *** [SDL_OpenGL_test] Error 1 Thx for any ideas that might come up.

Share this post


Link to post
Share on other sites
Advertisement
If it's building ok then you are including all the right stuff..

It appears to be failing at the linking stage..

Assuming you are using XCode then what you need to do is make sure that there is 'Link Binary With Libraries' section in your target project. Target is the red bulls-eye part way down the left panel in XCode. Your target project will be in there.

If there isn't a 'Link Binary with Libraries' in it, make one. But there really should be one there!

Then drag the SDL framework icon into it.

Let me know if you still have problems after that..

EDIT - Re-reading your post I realize you are using Eclipse, which I am not familiar with. But basically the problem remains the same.. You need to setup linking for the framework.

Share this post


Link to post
Share on other sites
Thx for the quick response! I'm working with an eclipse project. So I can't do what you asked for. The sample compiles fine with XCode btw. I'm trying to use eclipse though because I want the project to be portable to my windows PC :-)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
I thought, that's what i have done:

g++ -I/Network/Servers/coleman.informatik.RWTH-Aachen.DE/Volumes/RAID2/Hiwis/kurtz/Library/Frameworks/SDL.framework/Versions/A/Headers -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/SDL_OpenGL_test.d" -MT"src/SDL_OpenGL_test.d" -o"src/SDL_OpenGL_test.o" "../src/SDL_OpenGL_test.cpp"

(I know, the line is bit lenghty, but it the framework is set as include path)

and

g++ -framework Cocoa -framework SDL /Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m -o "SDL_OpenGL_test" ./src/SDL_OpenGL_test.o

All the files are where they are supposed to be (if I'm not missing anything because I'm unaware of Mac specifics)

Share this post


Link to post
Share on other sites
What does the include / import statement look like in SDLMain.m?

/Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m:8:21: error: SDL/SDL.h: No such file or directory

Share this post


Link to post
Share on other sites
Edit: IGNORE THAT!

Thx again, I found out, that the '~' is not part of the '*absolute path to your*' placeholder. Now I only get one error left:

g++ -framework Cocoa -framework SDL ~/Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m -o "SDL_OpenGL_test" ./src/SDL_OpenGL_test.o
i686-apple-darwin9-g++-4.0.1: /Network/Servers/coleman.informatik.RWTH-Aachen.DE/Volumes/RAID2/Hiwis/kurtz/Users/Shared/Cpp_workspace/SDL_OpenGL_test/src/SDLMain.m: No such file or directory
make: *** [SDL_OpenGL_test] Error 1

Edit: IGNORE THAT!

Share this post


Link to post
Share on other sites
Paths can be funny things on the Mac:

~ is actually your Home folder. So you now are not getting to SDLMain.m

/Users... should be ok.

You could also use

/Volumes/<your sys volume>/Users/..

I am thinking that the SDL/SDL.h needs to be changed in SDLMain.m to point to the header files properly (for your implementation).

In XCode #include or #import <SDL/SDL.h> directs it to look inside a framework with the first half of the filename being the frameworks name..

A Quick and Dirty solution is to change that to an absolute path, or an include path within your project and make a copy of SDL.h there.

Share this post


Link to post
Share on other sites
Thx again, but has not changed anything :-( (sure bout changing the include to SDLMain.m? Isn't that a circle reference?)

Could it be, that for some weird reason eclipse may not access the Framework-Folder while XCode can (it's located on a server)?

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!