The code seems to have no errors. but as it mentioned above this has been a compiler issue so switching to Cygwin from MinGW has solved the error.
The error code 0xc0000139 appears when mis-configured, important files gone missing or damaged. so switching in to a totally different compiler has solved the problem.
hope this will help to improve this questions value @Daniel D.