I'm not seeing the
-lmingw32 -lSDL2main -lSDL2
flags. What tutorial are you following? Also GCC 6 is quite outdated (latest is 14), I recommend installing the latest one from MSYS2.