SDL (unfortunately, IMO) does this strange thing where they redefine main
, in order to abstract away platform specific details of the entry point in applications. In order to not utilize this feature, perform the following. Before including SDL.h
, first define SDL_MAIN_HANDLED
.
#define SDL_MAIN_HANDLED
#include <SDL2/SDL.h>
That inhibits the redefinition of main
. Then, in main
, before doing anything else with SDL, call this function
SDL_SetMainReady();
That will do any initialization that is needed by SDL (currently does nothing other than setting a global variable named SDL_MainIsReady
to true).