SDL_init (sdl3) error

i’m changing a 32 bits game that i have with winapi, to sdl, I tried diferents codes, now i have this in my principal file, i’m using microsoft visual studio.

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) {
MessageBoxA(
NULL,
MB_OK
);
return 0;
}

everycode I tried, has de same problem:
LNK2019 _SDL_Init no resolvend in function
_WinMain@16

I suspect you have a similar problem to mine. It’s SDL2 but I was able to get around it like this-

#if defined(_WIN64)
int WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) 
#else
int main(int argc, char *argv[])
#endif

You’re linking in the SDL library, right?

So in SDL3, you can just include SDL3/SDL_main.h, and it’ll handle this for you. So you just have to have a main(argc, argv) function, and SDL will provide the WinMain magic for you.

Relavant documentation here:

I think the error was saying that in his WinMain function, he’s calling SDL_Init, but the linker can’t find that symbol, but maybe I’m misreading it.