Pelles C forum

C language => Beginner questions => Topic started by: ly47 on June 24, 2014, 11:55:28 AM

Title: Undeclared identifier 'errno_t'
Post by: ly47 on June 24, 2014, 11:55:28 AM
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


Title: Re: Undeclared identifier 'errno_t'
Post by: frankie on June 24, 2014, 12:44:00 PM
As per strict C99-C11 standards you have to explicitly enable secure functions:
Code: [Select]
// 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>
Title: Re: Undeclared identifier 'errno_t'
Post by: ly47 on June 24, 2014, 01:40:51 PM
Hi frankie
Thanks a lot.
ly