Using Android Ndk And C++
I got the sample HelloJni project working, which uses a C file for the native code. I have not been able to get any simple examples working with C++. Take the following JNI code:
Solution 1:
You might need to surround your code with an extern "C"
block:
extern"C" {
JNIEXPORT ...
}
You should be able to make a version that will work in both C and C++ by wrapping the extern block in #if
:
#ifdef __cplusplusextern"C" {
#endif
JNIEXPORT ...
#ifdef __cplusplus
}
#endif
Solution 2:
Solution 3:
try putting extern "C" around the exported function definitions.
Post a Comment for "Using Android Ndk And C++"