The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_Init fails on iOS 10/Xcode 8.0 (Free Pascal)
genericptr


Joined: 06 Oct 2016
Posts: 3
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


Joined: 06 Oct 2016
Posts: 3
I found some other linker warnings I wanted to include also. Something is wrong my compilers linker settings I think (I'm asking them now) but how can I get better debug info from SDL so I can know if these are related or not?

ld: warning: URGENT: building for iOS, but linking in object file (/usr/lib/crt1.o) built for OSX. Note: This will be an error in the future.
ld: warning: object file (/usr/lib/crt1.o) was built for newer OSX version (10.4) than being linked (7.0)
ld: warning: object file (/Developer/Projects/OpenGL-Sandbox/Xcode-SDL/DerivedData/OpenGL-Sanbox/Build/Intermediates/OpenGL-Sanbox.build/Debug-iphonesimulator/OpenGL-Sanbox.build/Objects-normal/x86_64/SDL.o) was built for newer iOS version (10.0) than being linked (7.0)
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


Joined: 06 Oct 2016
Posts: 3
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.