[SDL2.x] WinMain vs. main

We could probably help you better if you told us what exactly is going wrong when using SDL2 :wink:

your mingw command is at least missing -lSDL2_main

but to actually work with SDL2_main, IIRC the mingw commandline must have this at the the end:
-lmingw32 -lSDL2main -lSDL2 -mwindows
It’s important that this comes after your source file(s) (or your object files if you don’t do compiling and linking in one step), and IIRC it’s important that -lmingw32 comes before -lSDL2main and that -lSDL2main is before -lSDL2.

Yes, it fucking sucks - this was the main inspiration for header-only main in SDL3 :slight_smile:

1 Like