1

我正在尝试仅使用 c++ 将我的所有应用程序从 IOS 和带有 JAVA EGL 的 ANDROID 移植到 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)
4

1 回答 1

3

回答 :

当您使用两个以上的静态库时,您应该像这样将 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.
于 2013-12-04T12:08:50.350 回答