SDL 3 Kompilierungsfehler



  • Moin!

    Folgenden Code habe ich:

    
    #include <SDL3/SDL.h>
    #define SDL_MAIN_USE_CALLBACKS
    #include <SDL3/SDL_main.h>
    
    // This function runs once at startup
    SDL_AppResult SDL_AppInit(void** appstate, int argc, char* argv[])
    {
    	SDL_Log("Init");
    	// Continue running the application
    	return SDL_APP_CONTINUE;
    }
    
    // This function runs when a new event (mouse input, keypresses, etc) occurs
    SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
    {
    	SDL_Log("Event");
    	switch (event->type)
    	{
    	case SDL_EVENT_QUIT:
    		// Quit the application with a success state
    		return SDL_APP_SUCCESS;
    	default:
    		// Continue running the application
    		return SDL_APP_CONTINUE;
    	}
    }
    
    // This function runs once per frame, and is the heart of the application
    SDL_AppResult SDL_AppIterate(void* appstate)
    {
    	SDL_Log("Iterate");
    	// Continue running the application
    	return SDL_APP_CONTINUE;
    }
    
    // This function runs once at shutdown
    void SDL_AppQuit(void* appstate, SDL_AppResult result)
    {
    	SDL_Log("Quit");
    }
    

    Leider bekomme ich beim kompilieren den Fehler, dass "SDL_main" fehlt.
    Ohne main ("Haupt Klasse") kann man dies nicht übersetzen (ist nachvollziebar).

    Leider fand ich bisher keine Lösung im Internet dafür.
    Vielleicht hat jemand hier eine Idee?

    Vielen Dank im Voraus!

    Grüße



  • SDL_Main ist der Programmeinsprungspunkt. Du bekommst vermutlich einen Linkerfehler, weil du die Funktion nicht bereitstellst.
    Laut SDl Wiki hat sie diese int SDL_main( int argc, char *argv[] ) Signatur und muss von dir implementiert werden.