Replace all #ifdef WIN32 with #ifdef _WIN32.
Redefine sleep() as Sleep() for Windows build.