【问题标题】:NativeActivity using C++使用 C++ 的 NativeActivity
【发布时间】:2013-12-20 21:46:30
【问题描述】:

我正在尝试仅使用 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)

【问题讨论】:

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


    【解决方案1】:

    答案:

    当你使用两个以上的静态库时,你应该像这样将 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.
    

    【讨论】:

      猜你喜欢
      • 2018-09-23
      • 2011-12-03
      • 1970-01-01
      • 2018-06-22
      • 1970-01-01
      • 2016-08-15
      • 2011-05-21
      • 1970-01-01
      • 2013-08-22
      相关资源
      最近更新 更多