strftime 已停止在我的 platformIO 项目中工作。今天早上运行得很好,我不知道我做了什么改变可能会导致这种情况。
我收到的错误是
identifier "strftime" is undefined
。现在应该从其中取出的 time.h 文件如下所示:
#ifndef _ESP_TIME_H
#define _ESP_TIME_H
#ifdef __cplusplus
extern "C" {
#endif
#include_next <time.h>
#define _POSIX_TIMERS 1
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC (clockid_t)4
#endif
#ifndef CLOCK_BOOTTIME
#define CLOCK_BOOTTIME (clockid_t)4
#endif
int clock_settime(clockid_t clock_id, const struct timespec *tp);
int clock_gettime(clockid_t clock_id, struct timespec *tp);
int clock_getres(clockid_t clock_id, struct timespec *res);
#ifdef __cplusplus
}
#endif
#endif /* _ESP_TIME_H */
这表明 platformIO 构建工具正在尝试使用 esp-idf 框架而不是我在 platformIO.ini 中配置的 arduino 框架进行构建。
任何意见将不胜感激,我不知所措......
我尝试删除项目中的 .pio 文件夹、platformIO 的包文件夹中的框架文件夹,并且我尝试过 clean 和 full clean 命令。
我找到了一种解决方法,我可以使用
strftime_l()
并使用本地化参数来调用它 NULL
。