Android NDK 编译 C++ 代码得到类型 'errno_t' 无法解析

Android NDK compiling C++ code gets a Type 'errno_t' could not be resolved

我正在使用 Android NDK 编译主要为 Mac OS 编写的 C++ 代码,但出现以下错误:

- Type 'errno_t' could not be resolved

在 Xcode 中,此类型在 OSX 10.0/usr/include/sys/_types/_errno_t.h 上定义为:

#ifndef _ERRNO_T
#define _ERRNO_T
typedef int                    errno_t;  
#endif  /* _ERRNO_T */

关于如何将其转换为 NDK,或添加编译器标志以进行编译,或什至从何处获取源代码以在我的源代码本身中定义此类型的任何建议?

谢谢。

有关 errno_t 的信息,请参阅 this answer

errno_t不是C标准的一部分,bionic不支持它。

解决方法就是将所有 errno_t 更改为 int