Type 'JNICALL' could not be resolved ,?

人走茶凉 提交于 2021-02-04 15:55:39

问题


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.

  1. Select Include tab and click on Add button right side of window
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!