【问题标题】:Android NDK compiling C++ code gets a Type 'errno_t' could not be resolvedAndroid NDK 编译 C++ 代码获取类型“errno_t”无法解析
【发布时间】:2015-02-09 15:38:55
【问题描述】:

我正在使用 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 是 POSIX / ISO 类型吗?我没有看到它在 Linux 下定义。如果_ERRNO_T 未定义(如您的问题中所示),您可能只需要自己在标题中定义它,或者只需在您的makefile 中抛出-Derrno_t=int。
  • 它似乎是一个 int,至少在 Obj-C 中是这样,所以在我找到更好的解决方案之前,我不会这样做。

标签: android c++ macos android-ndk


【解决方案1】:

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

errno_t 不是 C 标准的一部分,仿生也不支持它。

解决方法是将所有errno_ts 更改为ints。

【讨论】:

  • 是的,这就是我最终所做的。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-12
相关资源
最近更新 更多