https://github.com/DaveGamble/cJSON
1.下载代码解压后,从里面找到两个文件cJSON.c、cJSON.h,复制到我们的工程里面
这里我把cJson的后缀改了一下 (改不改都可以)
2.配置cmaklists.txt
add_library( # Sets the name of the library.
cJSON
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
cJSON.cpp)
find_library( # Sets the name of the path variable.
cJSON
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
target_link_libraries( # Specifies the target library.
#此处写调用这个库xxx.cpp文件名称
xxx
# Links the target library to the log library
# included in the NDK.
cJSON
${log-lib} )
3.在xxx.cpp中引入
#include "cJSON.h"
刚入门记录一下 可能有错的地方