You will need <time.h> and <errno.h>, available in C++ as <ctime> and <cerrno>.

usleep is simpler to use (just multiply by 1000, so make it an inline function). However, it's impossible to guarantee that that sleeping will occur for a given amount of time, it's deprecated, and you need to extern "C" { }-include <unistd.h>.

Note: sleep (lowercase 's'), whose declaration is in <unistd.h>, is not an acceptable substitute, since its granularity is seconds, coarser than that of Windows' Sleep (uppercase 's'), which has a granularity of milliseconds.

Regarding your second error, ___XXXcall is a MSVC++-specific token (as are __dllXXX, __naked, __inline, etc.). If you really need stdcall, use __attribute__((stdcall)) or similar to emulate it in gcc.

Note: unless your compile target is a Windows binary and you're using Win32 APIs, use of or a requirement for stdcall is A Bad Sign™.

Email codedump link for C++ error : Sleep was not declared in this scope