在github下载jsoncpp源码
把相关头文件拷贝到工具链的usr/include/json
把cpp文件及本地头文件放到文件夹下,make生成libjsoncpp.so,把libjsoncpp拷贝到工具链的usr/lib下
makefile如下
#编译: make tg=xxx
target = libjsoncpp.so
cc = arm-nuvoton-linux-xxx-g++
srcs = $(wildcard ./src/*.cpp) $(wildcard ./*.cpp)
includes = -I./include/
OBJS =$(patsubst %cpp, %o, $(srcs))
CFLAGS =-std=c++11 -shared -fPIC
all: $(target)
$(target): $(OBJS)
$(cc) $(CFLAGS) $(OBJS) -o $@
%.o:%.cpp
$(cc) -c $(INCLUDES) $(CFLAGS) $^ -o $@
#%.o:%.cpp
# $(cc) -c -pthread $(INCLUDES) $(CFLAGS) $^ -o $@
clean:
rm -f *.o *.so
.PHONY:clean



