Undeclared identifier 'errno_t'

Started by ly47, June 24, 2014, 11:55:28 AM

Previous topic - Next topic

ly47

Hi
I try to compile an example from MSDN.(using 'openf_s' function)
I get errors:
error #2048: Undeclared identifier 'errno_t'.
error #2001: Syntax error: expected ';' but found 'err'.
error #2048: Undeclared identifier 'err'.
warning #2018: Undeclared function 'fopen_s'; assuming 'extern' returning 'int'.
(No problem compiling with lcc-win)
Attached file.
If I change  'errno_t err;' to int err; it compiles without errors, only warning: warning #2018: Undeclared function 'fopen_s'; assuming 'extern' returning 'int'.
Please help.
Thanks
ly



frankie

As per strict C99-C11 standards you have to explicitly enable secure functions:

// crt_fopen_s.c
// This program opens two files. It uses
// fclose to close the first file and
// _fcloseall to close all remaining files.

#define __STDC_WANT_LIB_EXT1__ 1 //define this to enable secure options
#include <stdio.h>
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

ly47