在Android的NDK中使用jsoncpp(2015-04-13 08:58:16)
http://blog.csdn.net/sniffer12345/article/details/7336732
http://blog.163.com/sylar_lin/blog/static/19233209320135811030796
之前想要用json庫,編譯很久沒編譯成功。后來看到上面兩個(gè)鏈接的文章,總結(jié)到如下mk文件,以此附上。
*Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsoncpp
LOCAL_CPPFLAGS := -fexceptions
#-DJSON_IS_AMALGAMATION
LOCAL_SRC_FILES := \
#jsoncpp.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..\
$(LOCAL_PATH)/json
LOCAL_LDLIBS := -L$(call host-path,
$(LOCAL_PATH)/../../libs/armeabi)
include $(BUILD_STATIC_LIBRARY)
說一下上面文件所對(duì)應(yīng)的目錄:
下載解壓后的jsoncpp中,將include/json中的頭文件放到Android工程的jni/jsoncpp/json文件夾下,
將src/json中的所有文件放到Android工程的jni/jsoncpp目錄下,Android.mk文件放到j(luò)soncpp目錄下。這樣編譯成功之后,就可以被其他庫所引用。
其他庫引用:LOCAL_STATIC_LIBRARIES := libjsoncpp |
|