error: use of undeclared identifier 'errno_t'

前端 未结 1 763
暖寄归人
暖寄归人 2020-12-17 16:51

Here is my dead simple dummy code:

#include 

int main(void)
{
    errno_t e;
    return 0;
}

Which surprisingly raises this

相关标签:
1条回答
  • 2020-12-17 17:33

    errno_t is not a standard type; it's part of the optional (and widely disliked and unsupported) Annex K, included with ISO C11 only because of one particular vendor with a history of ignoring and sabotaging the standard.

    Since Annex K defines errno_t as int, the type of the errno object is int, and all error codes are int, simply use int in your programs. It's much more portable than relying on an optional feature which is unlikely to be supported.

    0 讨论(0)
提交回复
热议问题