I am trying to compile the following for the android ndk
#include <jni.h>
#include <string.h>
extern "C" {
JNIEXPORT jstring JNICALL Java_com_knucklegames_helloCpp_testFunction(JNIEnv * env, jobject obj);
};
JNIEXPORT jstring JNICALL Java_com_knucklegames_helloCpp_testFunction(JNIEnv *env, jobject obj) {
return env->NewStringUTF(env, "Hello from native code!");
}
but it is giving the following error
Compile++ thumb: helloCpp <= /cygdrive/c/workspace/helloCpp/jni/main.cpp
/cygdrive/c/workspace/helloCpp/jni/main.cpp: In function '_jstring* Java_com_knucklegames_hello
Cpp_testFunction(JNIEnv*, _jobject*)':
/cygdrive/c/workspace/helloCpp/jni/main.cpp:10: error: no matching function for call to '_JNIEn
v::NewStringUTF(JNIEnv*&, const char [24])'
/cygdrive/d/android/android-ndk-r4b/build/platforms/android-8/arch-arm/usr/include/jni.h:839: note: candidates
are: _jstring* _JNIEnv::NewStringUTF(const char*)
make: *** [/cygdrive/c/workspace/helloCpp/obj/local/armeabi/objs/helloCpp/main.o] Error 1