SDL2 Undefined Reference (native MinGW-w64 and MXE)
Last thing I want to do is to ask *this* one question which has been asked so many times. Anyways...
I can't get my SDL2 game to link for Windows (though it compiles and links perfectly on Linux). The errors are
C:\msys64\tmp\ccXMO8av.o: In function `SDL_main':
C:\msys64\home\naman\ascend/src/game/ascend.c:102: undefined reference to `SDL_LogInfo'
C:\msys64\home\naman\ascend/src/game/ascend.c:104: undefined reference to `SDL_LogInfo'
C:\msys64\home\naman\ascend/src/game/ascend.c:114: undefined reference to `SDL_LogInfo'
C:\msys64\home\naman\ascend/src/game/ascend.c:116: undefined reference to `SDL_GL_DeleteContext'
C:\msys64\home\naman\ascend/src/game/ascend.c:117: undefined reference to `SDL_DestroyWindow'
C:\msys64\home\naman\ascend/src/game/ascend.c:118: undefined reference to `SDL_Quit'
and so on for ~50 more lines.
On MXE while cross-compiling, using $(sdl-config --libs) didn't work (same errors) but $(sdl-config --static-libs) did. Fine. Whatever.
Now, on Windows 7 64-bit using MinGW-w64 (installed through MSYS2), that doesn't work either through gcc or clang (on 32-bit "namespace" i.e. /mingw32). SDL2 was installed using packages mingw-w64-i686-SDL2
The paths generated by sdl-config are correct; and according to numerous answers all around the internet, so are the flags. Only weird thing I can find is that MSYS2 doesn't install libSDL2.la file in /mingw32/lib. However, it doesn't work even if if I manually change these paths appropriately to point to SDL2-devel-2.0.4-mingw.tar.gz's content.