Change wrt. SDL_main in 2.0.18?

Hi everyone,

has there been a change wrt. the handling of SDL_main in the most recent update v2.0.18? I ask because after updating my game frame work from v2.0.16 to this version I observer the following:

  • Under macOS everything works as before
  • Under Windows I get an “undefined symbol _SDL_main” linker error which disappears after defining SDL_MAIN_HANDLED. After that everything works.
  • Under iOS I also get the “undefined symbol _SDL_main” linker error which also disappears after defining SDL_MAIN_HANDLED. However, when running I get the SDL init error “Application didn’t initialize properly, did you include SDL_main.h in the file containing your main()”. This is also doesn’t resolved when I include <SDL_main.h> in my main.cpp.

Some more background info: on macOS and iOS I built static libraries of SDL2 myself while on Windows I downloaded the precompiled binaries.

Edit: I found this commit that adds iOS build targets for libSDLmain:

So I thought I might need to add libSDLmain.a as a new dependency for the iOS build but this also didn’t help.

Any hint is appreciated!


Figured it out. Turns out I slightly altered my own main()'s signature by using const char** args instead of the usual char** args which apparently lead to the linker problems.

After reverting this change, replacing the static libs of SDL v2.0.16 with v2.0.18 makes no further adaptations necessary.