NO

Author Topic: Undeclared identifier 'errno_t'  (Read 1850 times)

ly47

  • Guest
Undeclared identifier 'errno_t'
« 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



Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1597
Re: Undeclared identifier 'errno_t'
« Reply #1 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>

ly47

  • Guest
Re: Undeclared identifier 'errno_t'
« Reply #2 on: June 24, 2014, 01:40:51 pm »
Hi frankie
Thanks a lot.
ly