无法包括的iostream android系统中,为什么? [英] Unable to include iostream in android why?
问题描述
已经安装的Android NDK-R7,并试图编译.cpp文件。
Have installed android-ndk-r7, and trying to compile .cpp file.
#include <iostream>
using namespace std;
int main ( int argc, char ** argv)
{
cout <<"Hello World.."<<endl;
}
已执行以下命令: 坐进JNI的文件夹,并执行
Executed following command: Got into jni folder, and executed
#ndk-build
得到了以下错误:
Got following error:
/home/jelari/Desktop/androidDevelopment/android-ndk-r7/DCF/jni/test1.cpp:1:20: error: iostream: No such file or directory
/home/jelari/Desktop/androidDevelopment/android-ndk-r7/DCF/jni/test1.cpp: In function 'int main(int, char**)':
/home/jelari/Desktop/androidDevelopment/android-ndk-r7/DCF/jni/test1.cpp:8: error: 'cout' was not declared in this scope
/home/jelari/Desktop/androidDevelopment/android-ndk-r7/DCF/jni/test1.cpp:8: error: 'endl' was not declared in this scope
make: *** [/home/jelari/Desktop/androidDevelopment/android-ndk-r7/DCF/obj/local/armeabi/objs/test1/test1.o] Error 1
我究竟做错了什么?
What am i doing wrong ?
我的Android.mk文件是这样的:
My Android.mk file looks like:
# A simple test for the minimal standard C++ library
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test1
LOCAL_SRC_FILES := test1.cpp
include $(BUILD_EXECUTABLE)
和Application.mk文件是这样的:
and Application.mk file looks like:
# Build both ARMv5TE and ARMv7-A machine code.
APP_ABI := armeabi armeabi-v7a
请指出错误了吗?
Kindly point out the mistake?
推荐答案
正是这样的答案是容易接近这里所以,在这里,它是:
Just so the answer is readily accessible here on SO, here it is:
默认情况下,C ++标准库是很小的。
By default, the C++ standard library is very minimal.
您需要在您的Application.mk文件中设置APP_STL。
You need to set APP_STL in your Application.mk file.
我使用的:
APP_STL:= gnustl_static
APP_STL := gnustl_static
但你也可以使用系统,stlport_static,stlport_shared,或 gnustl_static。
but you could have used system, stlport_static, stlport_shared, or gnustl_static.
它在$ NDK /文档/ CPLUSPLUS-SUPPORT.html记录,这是一个 小隐,因为$ NDK / documentation.html获得索引文件不 列出来。
It's documented under $NDK/docs/CPLUSPLUS-SUPPORT.html, and it's a little hidden, because the $NDK/documentation.html index file doesn't list it.
从<一个报价href="http://groups.google.com/group/android-ndk/browse_thread/thread/983c436239d48704?pli=1">http://groups.google.com/group/android-ndk/browse_thread/thread/983c436239d48704?pli=1
这篇关于无法包括的iostream android系统中,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!