title: How to build ndk with multiple c++ files
body: <p>Some one help me on this please. </p>
  
  <p>I am working on a simple app the does factorial on android, using ndk.</p>
  
  <p>I want to have 2 .cpp files, one for class factorial, and one will be the main that invokes method from that class.
  I don't know how to deal with the header problem when it comes to build, please help.</p>
  
  <pre><code>#include "com_lan_factorial_FacLib.h"
  
  JNIEXPORT jlong JNICALL Java_com_lan_factorial_FacLib_fac
    (JNIEnv *env, jclass clazz, jlong n)
  
  {
  
  
      jlong result = (jLong) (fac(n));
  
      return result;
  }
  </code></pre>
  
  <p>This code call fac method. this is Main.cpp</p>
  
  <pre><code>#include &lt;stdio&gt;
  #include "com_lan_factorial_FacLib.h"
  
  long fac(long n)
      {
          long f = 1;
          long i;
          for(i = 1; i &lt;= n; i++)
          {
               f *= i;
          }
          return f;
      }
  }
  </code></pre>
  
  <p>This class create fac method. This is fac.cpp</p>
  
  <pre><code>LOCAL_PATH:= $(call my-dir)
  include $(CLEAR_VARS)
  LOCAL_CFLAGS := -Wno-psabi
  LOCAL_MODULE := libfac
  LOCAL_SRC_FILES := fac.cpp
  LOCAL_C_INCLUDES := $(LOCAL_PATH)
  include $(BUILD_STATIC_LIBRARY)
  
  include $(CLEAR_VARS)
  
  LOCAL_CFLAGS := -Wno-psabi
  LOCAL_MODULE := FacLib
  LOCAL_SRC_FILES := Main.cpp 
  LOCAL_STATIC_LIBRARIES := libfac
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>The compile log is:</p>
  
  <pre><code>C:\Users\Lan\workspace\Factorial&gt;..\..\temp\android\android-ndk-r8b\ndk-build
  "Compile++ thumb : FacLib &lt;= Main.cpp
  jni/Main.cpp: In function 'jlong Java_com_lan_factorial_FacLib_fac(JNIEnv*, jclass, jlong)':
  jni/Main.cpp:7:30: error: 'fac' was not declared in this scope
  make: *** [obj/local/armeabi/objs/FacLib/Main.o] Error 1
  </code></pre>
  
  <p>Im not sure why fac is not declare</p>