Android ndk-build iostream: No hay tal archivo o directorio


Tengo problemas con la compilación de archivos cpp usando la herramienta ndk-build (windows 7 con cygwin) Aparece un error cuando intento compilar el archivo cpp con # include:

jni/native.cpp:5:20: error: iostream: No such file or directory

Aquí está mi archivo cpp:

#include <jni.h>
#include <string.h>
#include <stdio.h>
#include <android/log.h>
#include <iostream>

#define DEBUG_TAG "NDK_SampleActivity"
#define  LOG_TAG    "hellojni"
#define  LOGI(...)  __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#define  LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)


#ifdef __cplusplus
extern "C" {
#endif

void Java_com_test_ndk_SampleActivity_helloLog(JNIEnv* env, jobject thisobj, jstring logThis)
{
    jboolean isCopy;

    const char * szLogThis = env->GetStringUTFChars(logThis, &isCopy);

    __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "NDK:LC: [%s]", szLogThis);

    env->ReleaseStringUTFChars(logThis, szLogThis);
}



#ifdef __cplusplus
}
#endif

Y aquí está mi Android.mk archivo:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

APP_STL:=stlport_static 

LOCAL_LDLIBS := -llog

LOCAL_MODULE    := swingbyte-android

LOCAL_SRC_FILES := native.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include-all
include $(BUILD_SHARED_LIBRARY)

Tengo el archivo iostream en la carpeta ndk de Android (NDK_ROOT\sources\cxx-stl\gnu-libstdc++\include) pero no tengo idea de cómo decirle al compilador que busque iotream (y otros archivos de encabezado standart) en esa carpeta.

Parece que que me falta una o pocas variables de entorno, o algunos indicadores de comiler.

Author: Andrey Zavarin, 2012-02-03

4 answers

Creo que "APP_STL: = stlport_static" debe estar en Application.mk archivo.

Crear un "Application.mk" file and write "APP_STL: = stlport_static" in it.

 61
Author: Gaetan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-03 14:49:00

Esto funciona para mí.

LOCAL_STATIC_LIBRARIES +=  libstlport

LOCAL_C_INCLUDES += external/stlport/stlport 
LOCAL_C_INCLUDES += bionic
 2
Author: iwtu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-04-23 13:55:44

Añadiendo

APP_PLATFORM := android-23

O cualquier revisión que uses lo resolvió para mí.

 1
Author: Antzi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-01 08:36:53

Actualiza tu ndk Android a la última. Me enfrenté a un error en Android ndk ver 5

 0
Author: Napolean,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-04 11:49:15