使用C ++的NativeActivity

时间:2013-12-04 12:00:18

标签: android c++ android-ndk native-activity

我正在尝试仅使用c ++从IOS移植Android设备上的所有应用程序,并使用JAVA EGL移植ANDROID。

我刚遇到的一件事是“致命错误:android_native_app_glue.h:没有这样的文件或目录”所以我要查看我的make文件,'Android.mk'在下面

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 个答案:

答案 0 :(得分:2)

答案:

当您使用两个以上的静态库时,您应该将import-module放置两次以上

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

根据NDK文件夹中的参考:

 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.