Skip to content

Note for Windows (using MSYS2) regarding SDL2's handling of main #2

@Polarfuchs0x137

Description

@Polarfuchs0x137

I tried using this on Windows with MSYS2, but after updating the paths in the makefile I still got an undefined reference to `WinMain' error. For anyone else potentially facing this problem:

To avoid this error you have to change the type of main from int main() to int main(int argc, char **argv) and put -lmingw32 -lSDL2main before -lSDL2.
(You can instead also put #define SDL_MAIN_HANDLED somewhere before #include <SDL2/SDL.h> in main.cas this bypasses SDL2's special handling of main, but I'm unsure of whether this could lead to other problems)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions