So I have a school project that uses error(). However I’m on a Windows machine and Visual Studio doesn’t appear to support the error() function. Since it’s nearly impossible to search on Google for “error()”. I was wondering exactly what this function does and if there is a compiler flag to enable error() support on Visual Studio (2010).
static void *
check_nonnull (void *p)
{
if (! p)
error (1, errno, "memory exhausted");
return p;
}
The
errorfunction is a GNU extension and is not available on Visual Studio.Its behaviour is described in the man page here: http://linux.die.net/man/3/error
It shouldn’t be difficult to write your own version (even easier if you don’t care about emulating every detail). You’ll need the strerror function, which is available in VS.