Compile error in Zephyr, can not find c funtion even include the head files

Hi Support team,

I'm compiling some c code with ncs v2.5.1,  the include files are:

#include <time.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
But there are some compiling errors:
(1)
C:/dataLogger/hello_world/src/remote/tahu/tahu.c: In function 'set_propertyvalue':
C:/dataLogger/hello_world/src/remote/tahu/tahu.c:104:45: warning: implicit declaration of function 'strndup'; did you mean 'strncmp'? [-Wimplicit-function-declaration]
104 | propertyvalue->value.string_value = strndup(value, size);
| ^~~~~~~
| strncmp
(2) 
C:/dataLogger/hello_world/src/remote/tahu/tahu.c: In function 'get_current_timestamp':
C:/dataLogger/hello_world/src/remote/tahu/tahu.c:341:5: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
341 | clock_gettime(CLOCK_REALTIME, &ts);
| ^~~~~~~~~~~~~
Why I include the right header files, but still can not find the function strndup() and clock_gettime() in Zephyr, should add some configuration in prj.conf?
Could you help give some hints? Thank you very much.
Best regards,
Yanpeng Wu.
Parents Reply Children
No Data
Related