Fix cmake build to use ansi stdio extensions when using a mingw compiler

https://bugs.freedesktop.org/show_bug.cgi?id=65238
Check for the correct number of arguments
Fix #end -> #endif
Compile