Discussion:
[SDL] SDL_Init fails on iOS 10/Xcode 8.0 (Free Pascal)
genericptr
2016-10-06 08:14:39 UTC
Permalink
I'm doing some tests with SDL now to see if it's viable but after getting it run on OS X I'm getting errors on iOS. I was able to get the test project in C working but my Free Pascal project is failing after building and running successfully in the Simulator.

The error I'm getting is from SDL_Init(SDL_INIT_VIDEO) returning -1 and SDL_GetError returning "Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"

In the Xcode log I found this one warning which is interesting. Does anyone know why this one file is being problematic for the linker? The error message I'm getting isn't very helpful either and I'm not sure if it's related to this or not.

ld: warning: ObjC object file (/Developer/Projects/OpenGL-Sandbox/Sources/libSDL2.a(SDL_rwopsbundlesupport.o)) was compiled for iOS Simulator, but linking for MacOSX
genericptr
2016-10-06 14:36:52 UTC
Permalink
I got this figured out from the Free Pascal Compiler guys who were actually familiar with SDL. The problem is the main function of the program was not named SDL_main like the it would have been if I used the C header. I don't understand why SDL worked on OS X and failed on iOS however. Should I file a bug report perhaps or request a more meaningful error message for non-C users? I suspect this will affect other non-C users and a simple error message stating the main function naming would have been enough for me to figure it out.
Loading...