I think you must partly rewrite the code, because it's mostly written in visual studio...with visual studio's functions that other compilers don't understand.
Oh, and a Tip: install MSYS too.
I liked the delicious linux-commands on the windows command line.