SDL OpenGL Xcode

Started by
6 comments, last by slanker70 14 years, 11 months ago
First of all I'm new in this forum so hello to all, Here's the problem: I'm porting a programme (SDL OpenGL)that works perfectly in windows(visual studio) and linux(codeblocks) to xcode. I'm using the SDL OpenGL project template and delete unnecessary files, after that I just Imported the codes straight to the project, build and run without any problem. The build error comes only if and when I altered the code to deliberately produces a build error which is understandably. But when I undo or revert to the previous existing code it then produces a build error: Timer::displayFPS() referenced from: SDL_main(long, char**)in Main.o _SDL_main referenced from [SDLMain applicationDidFinishLaunching:] in SDLMain.o Timer::getTimeToDelay() referenced from: SDL_main(long, char**)in Main.o symbols(s) not found collect2: id returned 1 exit status Many thanks, Perdana Putra
Advertisement
If you do a clean and rebuild after introducing the error, does the error go away?
Hi,

Thanks for the reply but unfortunately it still produces an error, alghouth this time it's only the _SDL_main referenced from though. Any other suggestions?

Regards,

Perdana Putra
IMX, Xcode can be flaky about dependencies, which is why I recommended the clean-and-rebuild. If you're getting an error when building from scratch though, I would guess that it's a 'real' error.

Is the error similar to the one included in your first post? If so, I'll ask the obvious questions: what is Timer? Is it part of your own code, or part of an external library? If the former, is the source file included in your project? If the latter, have you linked to the library in question?
Yes Timer is a part of the code.

When I did clean and build this the only error left.

_SDL_main referenced from
[SDLMain applicationDidFinishLaunching:] in SDLMain.o
symbols(s) not found
collect2: id returned 1 exit status

Regards,

Perdana Putra
I assume that the project template (without any alterations) builds successfully? If so, in adding your own code and otherwise modifying the project you must have made a change that introduced the error.

You said you 'deleted some unnecessary files'. What were they?
I think the problem is that the signature of your main function is not as follows:

int main(int argc, char *argv[])

It MUST follow that form and not deviate from it because SDL sometimes replaces it using a macro.
Hi,

Thank you for all the replies, I've finally solved it.

It seems the error was indeed cause by:

int main(int argc, char *argv[])

Spcefied by mistake to:

GLsizei (GLsizei argc, GLbyte *argv[])

by mistake when use the "replace all".

Found another interesting thing though just as jyk said regarding using the clean & rebuild, and dependencies issues. For the application I did a test by deliberately making a typo and it still builds and runs fine, only when I use clean and rebuild then the error were spotted. Is that a a bug or just a standard thing when using Xcode?

Regards,

Perdana Putra

This topic is closed to new replies.

Advertisement