Here's a simple example:
#include <stdlib.h>
int main(void) {
_set_error_mode(_OUT_TO_STDERR);
return EXIT_SUCCESS;
}
When compiling this program, I get the following problems:
main.c: In function 'main':
main.c:4: error: implicit declaration of function '_set_error_mode'
main.c:4: error: '_OUT_TO_STDERR' undeclared (first use in this function)
main.c:4: error: (Each undeclared identifier is reported only once
main.c:4: error: for each function it appears in.)
The header does contain the function declaration and the macro:
_CRTIMP int __cdecl __MINGW_NOTHROW _set_error_mode (int);
# define _OUT_TO_STDERR 1
How come I get the errors? Notice that I also used the EXIT_SUCCESS
macro which is also defined in the same stdlib.h
header but for some reason GCC doesn't complain about it. Odd.
I'm using MinGW + GCC on a Vista machine.