Android NDK 中的某些 c++ 包含文件不起作用



我正在使用android JNI来使用一些c ++代码。 但是我应该如何处理以下问题android jni 无法识别 c++ 版本的某些包含文件中的包含文件:

#include <string>
#include <iostream>
#include <fstream>

所以读取文件的某些代码无法使用

例如:istream ,getline(), string,我应该如何找到替代解决方案?

和一些传递函数, std::stoull( std::wstring& ), atof, and so on,这对我的模块来说是微不足道的,

有没有人有类似的经历?

您需要定义要在Application.mk中使用的适当C++运行时。

例如:

APP_STL := gnustl_static


引用docs/CPLUSPLUS-SUPPORT.html

要选择要使用的运行时APP_STL,请在 Application.mk 为以下值之一:

system -> 使用默认的最小系统C++运行时库。
gabi++_static -> 将 GAbi++ 运行时用作静态库。
gabi++_shared -> 将 GAbi++ 运行时用作共享库。
stlport_static -> 将 STLport 运行时用作静态库。
stlport_shared -> 将 STLport 运行时用作共享库。
gnustl_static -> 使用 GNU STL 作为静态库。
gnustl_shared -> 将 GNU STL 用作共享库。

如果未指定要使用的默认值为 system ,它仅提供以下 STL 标头:

Cassert cctype cerno cfloat climits cmath csetjmp csignal
CSTDDEF CSTDINT CSTDIO CSTDlib CSTRING ctime CWCHAR New stl_pair.H
类型信息实用程序

最新更新