3
我正在嘗試使用Android NDK編譯我的C代碼。我按照Android developer NDK Page的建議下載和安裝,並試圖按照規定進行編譯,但似乎存在一些問題,我似乎不知道它是什麼。雙模塊定義錯誤
*** Command Line compile code **
C:\cygwin\android-ndk-r7c>ndk-build -C C:\Users\BoosterJack\workspace\workAndroid
Android NDK: Trying to define local module 'stdc++' in C:/cygwin/android-ndk-r7c/sources/cxx-stl/system/Android.mk.
Android NDK: But this module was already defined by C:/cygwin/android-ndk-r7c/sources/cxx-stl/system/Android.mk.
make: Entering directory `C:/Users/BoosterJack/workspace/workAndroid'
C:/cygwin/android-ndk-r7c/build/core/build-module.mk:34: *** Android NDK: Aborting. . Stop.
make: Leaving directory `C:/Users/BoosterJack/workspace/workAndroid'
我的make文件也很簡單。任何幫助將不勝感激。
# Include makefiles here.
include $(LOCAL_PATH)/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := NativeLibjni
LOCAL_SRC_FILES := NativeLib.c
include $(BUILD_SHARED_LIBRARY)
UPDATE
當我刪除從我的makefile線,包括$(LOCAL_PATH)/Android.mk,我得到正確的輸出是
C:\Users\BoosterJack>ndk-build -C C:\Users\BoosterJack\workspace\workAndroid
make: Entering directory `C:/Users/BoosterJack/workspace/workAndroid'
"Compile thumb : NativeLibjni <= NativeLib.c
SharedLibrary : libNativeLibjni.so
Install : libNativeLibjni.so => libs/armeabi/libNativeLibjni.so
make: Leaving directory `C:/Users/BoosterJack/workspace/workAndroid'
這是我試圖包含我準備好的Android.mk文件。那是錯的嗎? – Kobojunkie 2012-04-15 13:43:41
您應該從放置Android.mk的目錄運行ndk-build。 Android.mk包含在構建系統所需的任何位置,但不包含它。你可以參考ndk/samples中有一個hello-jni項目 – 2012-04-15 13:59:25