RTOS SDK V1.4 ,cJSON 链接错误!

yjl4390
Posts: 2
Joined: Mon Mar 07, 2016 12:49 pm

RTOS SDK V1.4 ,cJSON 链接错误!

Postby yjl4390 » Mon Mar 07, 2016 3:12 pm

hello ,
xtensa-lx106-elf-ar ru .output/eagle/debug/lib/libuser.a .output/eagle/debug/obj/ch_socket_udp.o .output/eagle/debug/obj/MyLibray.o .output/eagle/debug/obj/Myprtinf.o .output/eagle/debug/obj/user_main.o
xtensa-lx106-elf-ar: creating .output/eagle/debug/lib/libuser.a
make[1]: warning: Clock skew detected. Your build may be incomplete.
make[1]: Leaving directory `/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user'
make: Warning: File `user/.output/eagle/debug/lib/libuser.a' has modification time 1.5 s in the future
xtensa-lx106-elf-gcc -L/mnt/Share/ESP8266_RTOS_SDK/lib -Wl,--gc-sections -nostdlib -T/mnt/Share/ESP8266_RTOS_SDK/ld/eagle.app.v6.ld -Wl,--no-check-sections -u call_user_start -Wl,-static -Wl,--start-group -lminic -lgcc -lhal -lphy -lpp -lnet80211 -lwpa -lcrypto -lmain -lfreertos -llwip -lespconn -lsmartconfig -lairkiss user/.output/eagle/debug/lib/libuser.a -Wl,--end-group -o .output/eagle/debug/image/eagle.app.v6.out
user/.output/eagle/debug/lib/libuser.a(user_main.o): In function `tcpip_server_init':
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:230: undefined reference to `cJSON_CreateObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:235: undefined reference to `cJSON_CreateNumber'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:239: undefined reference to `cJSON_AddItemToObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:239: undefined reference to `cJSON_CreateString'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:239: undefined reference to `cJSON_Print'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:239: undefined reference to `cJSON_Delete'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:251: undefined reference to `cJSON_CreateObject'
user/.output/eagle/debug/lib/libuser.a(user_main.o):(.text.user_init+0x80): undefined reference to `cJSON_CreateNumber'
user/.output/eagle/debug/lib/libuser.a(user_main.o): In function `user_init':
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:340: undefined reference to `cJSON_AddItemToObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:343: undefined reference to `cJSON_CreateNumber'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:343: undefined reference to `cJSON_AddItemToObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:351: undefined reference to `cJSON_CreateString'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:353: undefined reference to `cJSON_AddItemToObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:353: undefined reference to `cJSON_CreateString'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:353: undefined reference to `cJSON_AddItemToObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:354: undefined reference to `cJSON_CreateString'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:354: undefined reference to `cJSON_AddItemToObject'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:355: undefined reference to `cJSON_Print'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:355: undefined reference to `cJSON_Delete'
/mnt/Share/ESP8266_RTOS_SDK/examples/smart_config/user/user_main.c:356: undefined reference to `cJSON_Delete'
collect2: error: ld returned 1 exit status
make: *** [.output/eagle/debug/image/eagle.app.v6.out] Error 1

我按照有篇帖子说在makefile 里加-"-lmirom" ,我加在 thiryparty 路径下的,但是还是编译不过,应该加在这里吗?
请指教?
这是我的测试代码,
cJSON * pJsonRoot = NULL;
pJsonRoot = cJSON_CreateObject();

cJSON_AddNumberToObject(pJsonRoot, "cmd", 1);
cJSON_AddNumberToObject(pJsonRoot, "pJsonRoot1", 1);
cJSON_AddStringToObject(pJsonRoot, "pJsonRoot2", "11111111111");
cJSON_AddStringToObject(pJsonRoot, "pJsonRoo3", "11111111111");
cJSON_AddStringToObject(pJsonRoot, "pJsonRoo4", "11111111111");

char * p = cJSON_Print(pJsonRoot);
if (NULL == p)
{
cJSON_Delete(pJsonRoot);
}

cJSON_Delete(pJsonRoot);
printf("%s", p);

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: RTOS SDK V1.4 ,cJSON 链接错误!

Postby ESP_Faye » Fri Mar 11, 2016 12:00 pm

您好,

您可以参考附件的 cjson_test/makefile 修改您的 makefile 再编译。

感谢您对 ESP8266 的关注!
Attachments
cjson_test.zip
(309.83 KiB) Downloaded 486 times

Who is online

Users browsing this forum: No registered users and 189 guests