# "Undefined reference to" error on NDK

This topic is 2044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,
now I use eclipse (with sequoyah) to write application with ndk for android.
I'm experiencing a strange problem where I can't succesfully include any classes into current cpp file which is invoked by android system.

My cpp fle looks like this:

 #include "Core/Ghost.h" #include "Multiplatform/PlatformAndroid.h" #ifdef ANDROID int g_nWidth, g_nHeight; Ghost* ghost_; Platform* platform_; extern "C" { void Java_com_ghost_Renderer_init(JNIEnv* env) { ghost_ = new Ghost(); } void Java_com_ghost_Renderer_resize(JNIEnv* env, void* reserved, int w, int h) { ghost_->resize(w, h); } void Java_com_ghost_Renderer_render(JNIEnv* env, void* reserved) { ghost_->computeFrame(); } }; #endif 

Whenever I try to use variable "ghost_" I get "Undefined reference to Ghost::..."

Any Ideas what might be causing this?

[EDIT] Apparently it has something to do with mk file, because after adding Ghost.cpp to it, the error went from Ghost to Renderer object which is used in Ghost.cpp. Unfortunately even adding all files to mk file didn't solve the problem.
[EDIT2] It was a syntax error on Renderer object. Now it works. But still, does that mean, that whenewer I add new files to project, I will also have to add them to mk file?

Thank you,
Martin Edited by Marusu