Fix tilegen compilation under mingw32

Order of linking the SDL libs and some missing Windows libraries.