freeRTOS xTimerCreate从'char *'到'const signed char *'的无效转换[-fpermissive]

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了freeRTOS xTimerCreate从'char *'到'const signed char *'的无效转换[-fpermissive]相关的知识,希望对你有一定的参考价值。

非常感谢您的贡献,我添加了代码来创建一个任务计时器,我需要定期运行一些工作,当我编译它给我一个错误,我不明白如何解决它,我看了各种讨论,但我找不到任何东西。

    #include “esp_common.h”
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include “esp_wps.h”
    #include “freertos/timers.h”
    #include “freertos/FreeRTOS.h”
    #include “freertos/task.h”
    #include “freertos/queue.h”

    xTimerHandle timer;

    void callback_timer (xTimerHandle xTimer)
    {
    }

    timer = xTimerCreate("timer",5000/portTICK_RATE_MS,pdTRUE,(void *)0, 
    callback_timer);

[Clang IntelliSense]错误:没有用于调用'xTimerCreate'的匹配函数

Errore从'char *'无效转换为'const signed char *'[-fpermissive]

enter image description here

请帮我

非常感谢

答案

只需将“timer”字符串转换为const signed char即可

代码如下所示:

timer = xTimerCreate((const signed char *)"timer",5000/portTICK_RATE_MS,pdTRUE,(void *)0, 
callback_timer);

以上是关于freeRTOS xTimerCreate从'char *'到'const signed char *'的无效转换[-fpermissive]的主要内容,如果未能解决你的问题,请参考以下文章

FreeRTOS 动态内存管理

从0开始的FreeRTOS

从0开始的FreeRTOS

从 freeRTOS 运行应用程序

无法从 USART 获取输入 - FreeRTOS - AT32UC3A0512

从0开始的FreeRTOS