Use "#include <errno.h>" instead of "extern int errno;". Suggested by