Error in JNI usage?

I was trying to add vibrator using the below post:

And some error appeared on compiling.

1) Suppose, in Classes/MyClass.cpp I’ve used vibrate(200) which is a function defined in jni/hellocpp/main.cpp

But in this MyClass.cpp it is giving me error that:

undefined reference to ‘MyClass::vibrate(int)’

But in actual I’ve defined my vibrate function not in MyClass.cpp but in main.cpp.

How to resolve?
I don’t know what to include in MyClass.cpp

2) Or can I simply put the function definiton from main.cpp to MyClass.cpp

Thanxx

I tried my 2nd point.

I removed the vibrate defintion from main.cpp and put it into MyClass.cpp
and included the necessary .h files which were included in main.cpp which are also as follows:
#include “platform/android/jni/JniHelper.h”
#include < jni.h>
#include < android/log.h>

And now it doesnot show the following error because it is able to find its definition of the declaration done in MyClass.h inside MyClass.cpp itself

undefined reference to ‘MyClass::vibrate(int)’
which I stated in my 1st point previous post

NO COMPILE TIME ERROR
BUT NOW, IT GIVES FOLLOWING ERROR IN LOGCAT::

03-03 14:33:12.792: A/libc(13344): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 13362 (Thread-134129)

What to do?
Is it because my tab may not have a vibrator?