I'd started porting some Java code in native c++ in Android. I have an issue with using strings in c++:
Type 'std::string' could not be resolved
There is my sample code
#include <jni.h>
#include <lexu_me_test_native.h>
#include <string.h>
using namespace std;
JNIEXPORT jstring JNICALL Java_lexu_me_test_native_prepairToShowNative
(JNIEnv * env, jclass javaThis, jstring str)
{
jboolean blnIsCopy;
jstring jstrOutput;
char* strCOut;
std::string ss;
const char* strCIn = (env)->GetStringUTFChars(str , &blnIsCopy);
// convert jstring to a char array
// Do stuff with the char array and and store the result
// in another char array strCOut
(env)->ReleaseStringUTFChars(str , strCIn); // release jstring
jstrOutput = (env)->NewStringUTF(strCOut); // convert char array to jstring
return jstrOutput;
}
Android.mk file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native
LOCAL_SRC_FILES := native.cpp
include $(BUILD_SHARED_LIBRARY)
Application.mk file:
APP_STL := stlport_static
MinGW installed and added to path. I tried using android-ndk-r8e and android-ndk-r8-crystax-1 nothing helped. In Cygwin Terminal errors:
Compile++ thumb : native <= native.cpp
jni/native.cpp: In function '_jstring* Java_lexu_me_test_native_prepairToShowNative(JNIEnv*, jclass, jstring)':
jni/native.cpp:11:2: error: 'string' was not declared in this scope
jni/native.cpp:11:9: error: expected ';' before 'ss'
I'm using Win 7 64bit. Can anyone say how it could be solved? Thanks.
EDIT.
In C/C++ General - Path and Symbols already set: C:\Android\android-ndk-r8e\platforms\android-14\arch-arm\usr\include