fix(c-client): 修复 SDK 头文件保护和 demo 编译问题
- SDK main.c: 添加条件编译 #ifndef/#define KENAITO_CONF_CLIENT_IMPL
- Demo main.c: 移除 #include SDK 源文件,改为 extern 声明函数
- 修复 demo 中访问 configs.count 的编译错误
编译方式:
gcc -o demo main.c ../kenaito-conf-c-client/main.c \
-I/usr/local/opt/cjson/include -L/usr/local/opt/cjson/lib \
-lcurl -lcjson -lpthread
This commit is contained in:
@@ -14,13 +14,16 @@
|
||||
* - pthread
|
||||
*
|
||||
* 编译:
|
||||
* 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
|
||||
*
|
||||
* @author odboy
|
||||
* @version 1.0.0
|
||||
* @date 2026-10-16
|
||||
*/
|
||||
|
||||
#ifndef KENAITO_CONF_CLIENT_IMPL
|
||||
#define KENAITO_CONF_CLIENT_IMPL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -440,3 +443,5 @@ void config_client_stop(ConfigClient *client) {
|
||||
curl_global_cleanup();
|
||||
printf("[Client] Stopped\n");
|
||||
}
|
||||
|
||||
#endif /* KENAITO_CONF_CLIENT_IMPL */
|
||||
|
||||
Reference in New Issue
Block a user