Fix compile error for cygwin1.7.18, add check __CYGWIN__ macro.

Patch other method for #263 .
I tested, all green.