简体   繁体   English

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

[英]some c++ include file in Android NDK does not work

I am using android JNI to use some c++ code. 我正在使用android JNI使用一些c ++代码。 but how should I cope with the problem of The android jni does not recognize the include file in c++ version's some include file: 但是我应该如何解决android jni无法识别c ++版本的一些include文件中的include文件的问题:

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

so some code of reading file can not use 因此某些读取文件的代码无法使用

for example : istream ,getline(), string , how should I find alternate solution? 例如: istream ,getline(), string ,应如何找到替代解决方案?

and some transfer function , std::stoull( std::wstring& ), atof, and so on , which are trivial to my module, 以及一些传递函数, std::stoull( std::wstring& ), atof, and so on ,这些对我的模块来说微不足道,

Did anyone have similar experience? 有没有类似的经历?

You need to define an appropriate C++ runtime to use in your Application.mk . 您需要定义一个适当的C ++运行时以在Application.mk使用。

For example: 例如:

APP_STL := gnustl_static


Quoting from docs/CPLUSPLUS-SUPPORT.html : 引用docs/CPLUSPLUS-SUPPORT.html

To select the runtime you want to use, define APP_STL inside your Application.mk to one of the following values: 若要选择要使用的运行时, APP_STL在Application.mk APP_STL定义为以下值之一:

system -> Use the default minimal system C++ runtime library. 系统->使用默认的最小系统C ++运行时库。
gabi++_static -> Use the GAbi++ runtime as a static library. gabi ++ _ static->将GAbi ++运行时用作静态库。
gabi++_shared -> Use the GAbi++ runtime as a shared library. gabi ++ _ shared->将GAbi ++运行时用作共享库。
stlport_static -> Use the STLport runtime as a static library. stlport_static->将STLport运行时用作静态库。
stlport_shared -> Use the STLport runtime as a shared library. stlport_shared->将STLport运行时用作共享库。
gnustl_static -> Use the GNU STL as a static library. gnustl_static->将GNU STL用作静态库。
gnustl_shared -> Use the GNU STL as a shared library. gnustl_shared->将GNU STL用作共享库。

The default if you don't specify which one to use is system , which only provides the following STL headers: 如果不指定使用哪个默认值,则默认值为system ,它仅提供以下STL标头:

cassert cctype cerrno cfloat climits cmath csetjmp csignal cassert cctype cerrno cfloat climits cmath csetjmp csignal
cstddef cstdint cstdio cstdlib cstring ctime cwchar new stl_pair.h cstddef cstdint cstdio cstdlib cstring ctime cwchar new stl_pair.h
typeinfo utility typeinfo实用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM