NativeActivity using C++

634 views Asked by At

I'm trying to only use c++ to porting all my apps on Android devices from IOS and from ANDROID with JAVA EGL.

One thing I just met is "fatal error: android_native_app_glue.h: No such file or directory" so I'm going over my make file , 'Android.mk' below

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_DEFAULT_CPP_EXTENSION := cpp   
LOCAL_MODULE    := StarEngine


LOCAL_SRC_FILES := \
    main.cpp \
    StarEngine.cpp \
    ../../../StarEngine/StarShader.cpp \
    ../../../StarEngine/StarTexture.cpp \
    ../../../StarEngine/StarFBO.cpp\
    ../../../StarEngine/StarTimer.cpp\
    ../../../StarEngine/StarMath/Matrix.cpp\
    ../../../StarEngine/StarMath/Random.cpp\
    ../../../StarEngine/StarMath/Transform.cpp\
    ../../../StarEngine/StarMath/Vector.cpp\
    ../../../StarEngine/StarMath/neonmath/neon_matrix_impl.cpp\
    ../../../StarEngine/StarMath/vfpmath/matrix_impl.cpp\
    ../../../StarEngine/StarMath/vfpmath/utility_impl.cpp\
    #../../../StarEngine/StarSound/StarSound.cpp

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
   LOCAL_CFLAGS := -D_ARM_ARCH_7=1 
   LOCAL_CPPFLAGS := -D_ARM_ARCH_7=1 
else

endif


    LOCAL_CFLAGS := -DCONFIG_EMBEDDED -DUSE_IND_THREAD -marm -mfpu=neon -mfloat-abi=softfp 
APP_STL  := stlport_static

LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -ldl -lGLESv2 -landroid -lEGL -lGLESv1_CM


LOCAL_STATIC_LIBRARIES := android_native_app_glue cpufeatures
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cpufeatures,android/native_app_glue)
1

There are 1 answers

0
Sung On BEST ANSWER

Answer :

When you use more than two static libraries you should put import-module more than twice like this

include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)
$(call import-module,cpufeatures)

According to the reference in NDK folder :

 import-module

    A function that allows you to find and include the Android.mk
    of another module by name. A typical example is:

      $(call import-module,<name>)

    And this will look for the module tagged <name> in the list of
    directories referenced by your NDK_MODULE_PATH environment
    variable, and include its Android.mk automatically for you.