C++ 从Android NDK共享对象中删除异常/展开函数

C++ 从Android NDK共享对象中删除异常/展开函数,c++,exception,gcc,android-ndk,compiler-flags,C++,Exception,Gcc,Android Ndk,Compiler Flags,无论我尝试什么,比如添加编译器标志-fno exceptions-fno rtti,我总是在共享对象中获得这些异常处理函数: 这是因为我编译为C还是C++?< /P> 这是用C++编写的(编译为C++没有尝试编译为C): #包括 #包括 #包括 #包括 #包括 下面是我编译的所有的C和C++的所有(大部分/所有这些都不需要出现的问题): #包括 #ifndef_uucplusplus #包括 #恩迪夫 #包括 #ifdef_uuAndroid__ #包括 #否则 #错误“目标平台没有图形实现

无论我尝试什么,比如添加编译器标志
-fno exceptions-fno rtti
,我总是在共享对象中获得这些异常处理函数:

<>这是因为我编译为C还是C++?< /P>

这是用C++编写的(编译为C++没有尝试编译为C):

#包括
#包括
#包括
#包括
#包括
下面是我编译的所有的C和C++的所有(大部分/所有这些都不需要出现的问题):

#包括
#ifndef_uucplusplus
#包括
#恩迪夫
#包括
#ifdef_uuAndroid__
#包括
#否则
#错误“目标平台没有图形实现”
#恩迪夫
#ifdef_uuAndroid__
#包括
#包括
#包括
#包括
#包括
#否则
#错误“目标平台没有音频实现”
#恩迪夫
#包括
typedef struct timespec timespec;
//对于malloc、free和memset
#包括
#包括

我怎样才能一劳永逸地摆脱这些异常处理函数呢?NDK工具链是否在某个地方覆盖了我的编译器标志?

这很可能是因为你链接到一个静态C++ STL。即使您的模块不使用异常,STL通常也会使用异常(NDK STL没有
-fno exceptions
变体)。

您是否将其他代码链接到您的代码中?你检查过你的.o文件以查看它们引用了什么吗?我正在使用jni.h以及标准的C库头文件,如math.h、stdint.h、stdlib.h和string.h,但没有使用任何其他库。你能告诉我如何检查我的.o文件吗?尽管这可能是一个准确的答案,但通常不鼓励简单地链接到另一个站点。要使这成为一个完整的答案,请保留链接,但也要总结图片中餐巾纸的内容。如果没有其他问题,这将在网站上保留答案,即使某一天你链接到的答案被删除。
#include <jni.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <jni.h>

#ifndef __cplusplus
#include <stdbool.h>
#endif

#include <math.h>

#ifdef __ANDROID__
#include <GLES2/gl2.h>
#else
#error "No graphics implementation for the target platform"
#endif

#ifdef __ANDROID__
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
#include <pthread.h>
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#else
#error "No audio implementation for the target platform"
#endif

#include <time.h>
typedef struct timespec timespec;

// for malloc, free and memset
#include <stdlib.h>
#include <string.h>