android - 默认情况下,Android NDK 工具链二进制文件构建时有无异常(exception)?

标签 android android-ndk

阅读 Android NDK 文档后,我对这个问题有点困惑。 CPLUSPLUS-SUPPORT.html 指出:

II.1. C++ Exceptions support:


The NDK toolchain supports C++ exceptions, since NDK r5, however all C++ sources are compiled with -fno-exceptions support by default, for compatibility reasons with previous releases.

但是,STANDALONE-TOOLCHAIN.html 说:

5.3 Exceptions, RTTI and STL:


The toolchain binaries do support C++ exceptions and RTTI by default. They are enabled by default, so use -fno-exceptions and -fno-rtti if you want to disable them when building sources with them (e.g. to generate smaller machine code).

这两个说法似乎完全矛盾。还是我误解了什么?那么异常是默认启用还是禁用?还是取决于其他因素?

我的猜测是其中一份文件只是从旧版本中继承下来的,这就是造成差异的原因,但我想知道哪个是正确的。

最佳答案

如果您正在使用提供的 ndk-build 系统来构建您的应用程序(您可能就是这样),那么默认情况下禁用异常

STANDALONE-TOOLCHAIN.html 仅在您直接将编译器与您自己的构建系统一起使用时适用,而不是使用 ndk-build。内容如下:

It is now possible to use the toolchains provided with the Android NDK as standalone compilers. This can be useful if you already have your own build system, and only need to ability to invoke the cross-compiler to add support to Android for it.

关于android - 默认情况下,Android NDK 工具链二进制文件构建时有无异常(exception)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9497289/

相关文章:

android - 如何使用两种不同的 Realm 配置

java - 索引越界异常

AndroidRuntime : java. lang.UnsatisfiedLinkError : Native method not found: com. example.compute.UseNDK.AddNumbers:(II)I

android - QT Widget 使用 OpenCV 错误部署到 Android

android - 在 Android 中,如何更改按钮的颜色,暂停几秒钟,然后再次更改?

android - Android View id 应该是唯一的吗?

android - Jenkins 无法连接到安卓模拟器

android - 'sizeof' 对不完整类型 'struct ether_arp' 的无效应用

java - NDK <Utils/Log.h> 没有那个文件或目录

android - 错误 : cannot access android. 应用程序 Activity