我对makefile很陌生。我正在使用命令从终端编译包含 cJson 库的 c 代码文件
gcc -test1.c -o test -lcjson
最后使用 -lcjson 并且运行完美。但是如何使用makefile编译相同的代码,因为我最后必须添加-lcjson。如果我在没有 -lcjson 的情况下使用,我会收到错误
/tmp/cc4ESrx1.o: In function `parse_json':
test1.c:(.text+0x2d): undefined reference to `cJSON_Parse'
test1.c:(.text+0x42): undefined reference to `cJSON_GetObjectItem'
test1.c:(.text+0x59): undefined reference to `cJSON_GetObjectItem'
collect2: error: ld returned 1 exit status
我正在使用 RTOS 代码
提前致谢