It's not trivial to compile and run ms-mpi applications using gnu tool chain on windows. There are a few articles online on how to use MinGW to compile and link MS-MPI applications.
The recommended approach would be to use the Visual Studio compiler (available at VisualStudio.com) and follow our tutorial below to compile and run MS-MPI applications: