I've been trying to set up SDL2 with MinGW, but I've encountered this error repeatedly:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
I have tried adding #define SDL_HANDLED_MAIN
to the top of main.cpp, and it does work, however I would like to know how I could get this running using SDL's system, and not bypassing it.
Linkers (in order): -lmingw32 -lSDL2main -lSDL2 -lSDL2_image
Code:
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <iostream>
int main(int argc, char **)
{
std::cout << "Hello world!" << std::endl;
std::cin.get();
return 0;
}