When I try to execute this SDL3 program:
// g++ -Wall -Ofast main.cpp -Iinclude -Iinclude/SDL3 -Linclude/SDL3 -lSDL3 -o build/program
#define SDL_MAIN_HANDLED
#include <iostream>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL.h>
int main(int argc, char* argv[]) {
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
SDL_Log("SDL_Init failed: %s", SDL_GetError());
return -1;
}
return 0;
}
... I get the following error:
SDL_Init failed:
(Note: SDL_GetError() doesn't return anything).
I'm using Windows 10 Pro.
if(!SDL_Init(SDL_INIT_VIDEOS))mainmanually works as it used to (note how it returnsintand notSDL_AppResult). On a related note, avoid definingSDL_MAIN_HANDLEDunless you actually know what that entails!