In android ndk when i use the header files that is generated by helper tool javah it works fine. but when i create a normal file with .h extension and include jni.h and any other required header files i am not able use the type or keyword or any functions from the included header files and it always shows me the “Type ‘whatever‘ couldn’t be resolved” while this same thing i can do in the machine generated header files with javah tools without any cause.
Though i’ve included arm platforms library in C/C++ General -> Paths and Symbols ->Include. it keeps showing me this error.
Consider the following piece of code.
#include "store.h"
#include <jni.h>
#include <stdint.h>
#include <pthread.h>
#ifndef _STOREWATCHER_H_
#define _STOREWATCHER_H_
#define SLEEP_DURATION 5
#define STATE_OK 0
#define STATE_KO 1
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
Store* mStore;
JavaVM* mJavaVM;
jobject mStoreFront;
pthread_t mThread;
int32_t mState;
}StoreWatcher;
#ifdef __cplusplus
}
#endif
#endif
it shows me in this code that Store, JavaVM, jobject, pthread_t couldn’t be resolved. Please help me.
any kind of help will be appreciated.
In C, unlike Java, you have files with names like
storewatcher.cand files with names likestorewatcher.h. The.hfiles are not compiled on themselves, you must use#includedirective in one or more.cfiles for the.hfile to be recognized by the compiler, e.g.