fix(c-client): 修正 cJSON 头文件路径和编译说明
- 修正头文件引用:cjson/cJSON.h(macOS Homebrew 标准路径) - 更新 README 编译说明: - macOS: 添加 -I/usr/local/opt/cjson/include 包含路径 - Ubuntu/Debian: 使用 pkg-config 自动获取包含路径 - 移除多余的 -lcjson 链接参数(编译时不需要)
This commit is contained in:
@@ -46,17 +46,37 @@ brew install cJSON
|
|||||||
|
|
||||||
### 2. 编译 SDK
|
### 2. 编译 SDK
|
||||||
|
|
||||||
|
**macOS:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd kenaito-conf-c-client
|
cd kenaito-conf-c-client
|
||||||
gcc -c main.c -o kenaito_conf.o -lcurl -lcjson
|
gcc -c main.c -o kenaito_conf.o -I/usr/local/opt/cjson/include -lcurl
|
||||||
|
ar rcs libkenaito_conf.a kenaito_conf.o
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ubuntu/Debian:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd kenaito-conf-c-client
|
||||||
|
gcc -c main.c -o kenaito_conf.o $(pkg-config --cflags libcjson) -lcurl
|
||||||
ar rcs libkenaito_conf.a kenaito_conf.o
|
ar rcs libkenaito_conf.a kenaito_conf.o
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. 编译 Demo
|
### 3. 编译 Demo
|
||||||
|
|
||||||
|
**macOS:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd kenaito-conf-c-client-demo
|
cd kenaito-conf-c-client-demo
|
||||||
gcc -o demo main.c ../kenaito-conf-c-client/main.c -lcurl -lcjson -lpthread
|
gcc -o demo main.c ../kenaito-conf-c-client/main.c -I/usr/local/opt/cjson/include -lcurl -lpthread
|
||||||
|
./demo
|
||||||
|
```
|
||||||
|
|
||||||
|
**Ubuntu/Debian:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd kenaito-conf-c-client-demo
|
||||||
|
gcc -o demo main.c ../kenaito-conf-c-client/main.c $(pkg-config --cflags libcjson) -lcurl -lpthread
|
||||||
./demo
|
./demo
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user