[SOLVED] Using SDL in XCode

Started by
22 comments, last by pseudobot 15 years ago
Oh! I just imported the SDLMain.m & .h files into my project. However, now I get these errors when compiling:
Quote:
/Users/Jonas/Desktop/cpp/SDL/../../SDLMain/NIBless/SDLMain.m:8:16: error: SDL.h: No such file or directory
/Users/Jonas/Desktop/cpp/SDL/../../SDLMain/NIBless/SDLMain.m:75: error: 'SDL_Event' undeclared (first use in this function)
/Users/Jonas/Desktop/cpp/SDL/../../SDLMain/NIBless/SDLMain.m:75: error: parse error before 'event'
/Users/Jonas/Desktop/cpp/SDL/../../SDLMain/NIBless/SDLMain.m:76: error: 'event' undeclared (first use in this function)
/Users/Jonas/Desktop/cpp/SDL/../../SDLMain/NIBless/SDLMain.m:76: error: 'SDL_QUIT' undeclared (first use in this function)

*Confused*

By the way, do you use XCode? If so, and if you want, could you please make a working SDL app (nothing fancy, just something that initializes SDL) and send it to my email?
Advertisement
ah were getting close :D change line 8 in SDLMain.m from

#import "SDL.h"

to

#import <SDL/SDL.h>
Noew I am getting this error:
Quote:
ZeroLink: unknown symbol '__NSConstantStringClassReference'

sdlapp has exited due to signal 6 (SIGABRT).



try adding the following frameworks:

Cocoa.framework
AppKit.framework
Foundation.framework

they should be in System/Library/Frameworks/
I am still getting the Signal 6 error. Do you use Xcode? If so, would it be possible to create a simple Project that Initializes SDL, and send it to me via email?
yes (version 3), and yes, one last thing to try however is disabling zerolink, under the build menu and see what it says when you build it
oops just noticed another thing (sorry this seems to be getting very long and convoluted) instead of 'int main()' you should have int 'main(int argc, char* argv[])'
I disabled zerolink & change the main functions arguments, however now Im getting this error when trying to build it:
Quote:
/usr/bin/ld: Undefined symbols:
_SDL_Init
_SDL_PushEvent


However, shouldn't
Quote:
int main() {}

work since it is C++?
hmm those are strange errors, the problem with 'int main()' and SDL is because of what I was saying earlier, your main function isn't actually the main function anymore SDL renames it to SDL_Main, and in SDLMain.m there is a function 'int main(int argc, char* argv[]) which tries to call SDL_Main(arc, argv), so you have to use the longer version or it won't work correctly
Edit: heres the sample project, should work for all versions now hopefully
http://www.mediafire.com/?sharekey=9712aa68860b89d5d2db6fb9a8902bda

This topic is closed to new replies.

Advertisement