title: NDK shared library "undefined reference to"
body: <p>I created very simple shared library and built it using NDK so that I wanna use it in a native android project, this library has a class called shaderprogram and its header file, I build it with this mk file</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  
  LOCAL_MODULE    := NativeGLLib
  LOCAL_SRC_FILES := NativeGLLib.cpp
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/includes
  APP_ABI:=all
  
  LOCAL_CPP_FEATURES += exceptions
  LOCAL_CPPFLAGS += -fexceptions
  
  LOCAL_LDLIBS := -lGLESv2
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>then I copy the includes folder manually to the native project jni folder and copy the libs content from the library build to jni/lib, it is contains versions for devices arm64-v8a, armeabi, armeabi-v7a and so on.
  I have a class called game.cpp where I implement the shared library</p>
  
  <pre><code>#include "includes/game.h"
  
  #include &lt;GLES2/gl2.h&gt;
  
  #include "includes/shaderprogram.h"
  
  using namespace std;
  using namespace GameEngine::Core;
  
  ShaderProgram shaderP;
  int programId;
  
  void on_surface_created() {
      glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
      glEnable(GL_DEPTH_TEST);
      programId = shaderP.getProgramId();
  }
  
  void on_surface_changed() {
      // No-op
  }
  
  void on_draw_frame() {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }
  </code></pre>
  
  <p>this is the android.mk file for the project</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  
  include $(CLEAR_VARS)
  LOCAL_MODULE    := mylib
  LOCAL_SRC_FILES := lib/$(APP_ABI)/libNativeGLLib.so
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/includes
  
  include $(PREBUILT_SHARED_LIBRARY)
  
  include $(CLEAR_VARS)
  LOCAL_MODULE    := game
  LOCAL_SRC_FILES := glnative.cpp game.cpp
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/includes
  LOCAL_SHARED_LIBRARIES := mylib
  
  LOCAL_CPP_FEATURES += exceptions
  LOCAL_CPPFLAGS += -fexceptions
  
  LOCAL_LDLIBS := -lGLESv2
  
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>when I try build the project I get this error</p>
  
  <pre><code>[arm64-v8a] SharedLibrary  : libgame.so
   ./obj/local/arm64-v8a/libNativeGLLib.so: error adding symbols: File in wrong format
  clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>make: *** [obj/local/arm64-v8a/libgame.so] Error 1</p>