2016-02-25 33 views
0

無論我怎麼努力,比如增加了編譯器標誌-fno-exceptions -fno-rtti,我總是在我的共享對象得到這些異常處理功能:刪除異常/開卷功能的共享對象

Image

出現這種情況無論我編譯爲C還是C++。

它發生這些包括(編譯爲C++ - 沒有試過編譯爲C):

#include <jni.h> 
#include <math.h> 
#include <stdint.h> 
#include <stdlib.h> 
#include <string.h> 

這裏是我的所有的包括一個我已經編譯爲C和C++(最/所有這些都不是需要的問題發生):

#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> 

我該如何擺脫這些異常處理函數一勞永逸? NDK工具鏈是否覆蓋了我的編譯器標誌?

+0

您是否將其他代碼與您的鏈接?你有沒有檢查過你的.o文件來查看他們引用的內容? – fadden

+0

我使用jni.h以及像math.h,stdint.h,stdlib.h和string.h這樣的標準C庫標題,但沒有使用任何其他庫。你能告訴我如何檢查我的.o文件嗎? – fgsfdsfgts

回答

0

這很可能是因爲您正在鏈接靜態C++ STL。即使你的模塊沒有使用異常,STL通常也是這樣(NDK STL沒有-fno-exceptions變種)。

+0

即使這可能是一個準確的答案,但只是簡單地鏈接到另一個站點通常是不鼓勵的。爲了使這個完整的答案,保持鏈接,但也總結了你的圖片餐巾紙說什麼。如果沒有其他的話,即使你鏈接到的某個人在某一天被取下,這也會在網站上保留答案。 – David