问题
i am trying to use the NDK in eclipse but when following a tutorial this error pops up and i do not understand where it comes from
this is my .h file
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_example_myproject_MainActivity */
#ifndef _Included_com_example_myproject_MainActivity
#define _Included_com_example_myproject_MainActivity
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_example_myproject_MainActivity
* Method: getMyData
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_com_example_myproject_MainActivity_getMyData
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
Error = Type 'JNICALL' could not be resolved
i also have syntax errors in the code view but these do not show up between the errors these appear with JNIEXPORT
回答1:
For the most part, JNICALL is used in windows. I'm 99% sure you can add
#define JNICALL
(define it as a blank)
Same with JNIEXPORT.
回答2:
Go to Project Properties->C/C++ General->Paths and Symbols.
- Select Include tab and click on Add button right side of window
- Choose include directory from File system
For example: C:\Program Files (x86)\Android\android-sdk\NDK\android-ndk-r10\platforms\android-L\arch-arm\usr\include.
It will ask you if you want to rebuild, click on yes...Done
回答3:
I just encountered this problem, here is my solution. If you worked on Linux with Java 7
, make sure these two include paths were added to you Includes
/usr/lib64/jvm/java-7-oracle/include/linux
/usr/lib64/jvm/java-7-oracle/include
来源:https://stackoverflow.com/questions/11561216/type-jnicall-could-not-be-resolved