NDK編譯C++,提示找不到頭文件
error: fstream: No such file or directory
error: set: No such file or directory
error: string: No such file or directory
解決辦法:
在所在目錄,新建文件Application.mk,添加 APP_STL := gnustl_static。
與STL相關的錯誤
1 異常相關的錯誤
error: exception handling disabled, use -fexceptions to enable。
2 某些STL函數找不到
undefined reference to `__cxa_end_cleanup'
undefined reference to `__cxa_begin_catch'
undefined reference to `__cxa_end_catch'
undefined reference to `__cxa_get_exception_ptr'
可以參考這里:http://blog.csdn.net/andyhuabing/article/details/8591459
動態庫編譯正常include $(BUILD_SHARED_LIBRARY),改成靜態庫不編譯include $(BUILD_STATIC_LIBRARY)
這是因為缺少Application.mk文件
解決方法:在<project>\jni\目錄下添加一個Application.mk文件,里面寫上一行代碼:
APP_MODULES := libexample
注意:libexample的名字要與Android.mk中LOCAL_MODULE=example的名字相同