[iOS] Trouble building SDL2 with -ObjC flag


#1

I got an issue when I am trying to build an single view iOS application with the -ObjC flag set in OTHER_LDFLAGS.

Here the error I got:

Undefined symbols for architecture arm64: "_SDL_main", referenced from: -[SDLUIKitDelegate postFinishLaunch] in libSDL2.a(SDL_uikitappdelegate.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

From what I understand, it seems that when you set this flag, it will load all members of static libraries that implement any Objective-C class or category. So, you need to specify this flag every time you need to call a category method that is implemented in a static library.

So I don’t understand what could be wrong with the libSDL2.a. Does anyone could help me on this?

Many thanks,

Thomas