Hmm, I'm really confused about your -mwindows which tells the linker to link windows libraries against the object file and generate win32 gui startup code.
I assume this is not you intention :-)
Did you use Makefile.unix ?
Just try to remove the -mwindows and compile again.