unknown type name 'blink_step_t'

Moderator: ESP_Bob

dexterzeng
Posts: 12
Joined: Thu May 05, 2022 1:37 pm

unknown type name 'blink_step_t'

Postby dexterzeng » Fri Apr 28, 2023 1:27 am

有谁用过ESP-IOT-Solution里的LED Indicator, 里面的结构体变量引用一直报错,component应该已经正常导入了, 用button组件都没有问题,LED这个组件一直会报错,引用方式上是不是要注意什么
unknown type name 'blink_step_t'

led_indicator.h
以下结构体存在于led_indicator.h
typedef struct {
blink_step_type_t type; /*!< action type in this step */
uint8_t value; /*!< hold on or off, set NULL if LED_BLINK_STOP or LED_BLINK_LOOP */
uint32_t hold_time_ms; /*!< hold time(ms), set NULL if not LED_BLINK_HOLD,*/
} blink_step_t;


main.c 但是main里引用还是会出现unknown type name 'blink_step_t'
#include "led_indicator.h"
static const blink_step_t double_blink[] = {
{LED_BLINK_HOLD, LED_STATE_ON, 500},
{LED_BLINK_HOLD, LED_STATE_OFF, 500},
{LED_BLINK_HOLD, LED_STATE_ON, 500},
{LED_BLINK_HOLD, LED_STATE_OFF, 500},
{LED_BLINK_STOP, 0, 0},
};

ESP_Junru
Posts: 49
Joined: Tue Jul 12, 2022 6:26 am

Re: unknown type name 'blink_step_t'

Postby ESP_Junru » Fri Apr 28, 2023 6:12 am

是使用的最新的 led_indicator 组件吗?能给出具体的 log 吗?https://components.espressif.com/compon ... 以访问到这个结构体的

dexterzeng
Posts: 12
Joined: Thu May 05, 2022 1:37 pm

Re: unknown type name 'blink_step_t'

Postby dexterzeng » Fri Apr 28, 2023 6:45 am

1.png
1.png (252.45 KiB) Viewed 6078 times
2.png
2.png (99.57 KiB) Viewed 6078 times
组件是最新的, 同样我用了你连接里最新的组件重新放进去编译也是一样, 像是找不到定义,我是直接把文件夹复制进component的方式加载的, 像其他的ADF的battery_service, IOT的button组件都在正常调用, 结构如下:
components\led_indicator
components\led_indicator\include
components\led_indicator\src

VSCODE里从main.c直接Go to Definition 是可以跳转到头文件的

ESP_Junru
Posts: 49
Joined: Tue Jul 12, 2022 6:26 am

Re: unknown type name 'blink_step_t'

Postby ESP_Junru » Fri Apr 28, 2023 6:52 am

你的components目录是和main目录同级吗?
-main
-components

感觉像是 led_indicator 这个组件没有被链接进编译。如果是放在外部的 components ,需要在 CMakeLists 中链接一下路径
Last edited by ESP_Junru on Fri Apr 28, 2023 6:55 am, edited 1 time in total.

ESP_Junru
Posts: 49
Joined: Tue Jul 12, 2022 6:26 am

Re: unknown type name 'blink_step_t'

Postby ESP_Junru » Fri Apr 28, 2023 6:53 am

可以尝试把这个工程去除掉build后打包发给我吗?

dexterzeng
Posts: 12
Joined: Thu May 05, 2022 1:37 pm

Re: unknown type name 'blink_step_t'

Postby dexterzeng » Fri Apr 28, 2023 6:57 am

3.png
3.png (44.34 KiB) Viewed 6073 times
是同级的, 而且我还尝试过修改CMakelist, 把led_indicator/src目录里的.c也直接拿到led_indicator/下,跟其他组件一样, 报错也没有变化, 一度怀疑编译器是不是有缓存, clean了好几次

ESP_Junru
Posts: 49
Joined: Tue Jul 12, 2022 6:26 am

Re: unknown type name 'blink_step_t'

Postby ESP_Junru » Fri Apr 28, 2023 7:13 am

删除掉 build 目录,重新编译

dexterzeng
Posts: 12
Joined: Thu May 05, 2022 1:37 pm

Re: unknown type name 'blink_step_t'

Postby dexterzeng » Fri Apr 28, 2023 7:50 am

私信发了代码包, 您这边看下有没有收到

ESP_Junru
Posts: 49
Joined: Tue Jul 12, 2022 6:26 am

Re: unknown type name 'blink_step_t'

Postby ESP_Junru » Fri Apr 28, 2023 9:11 am

我将你除了 LED_INDICATOR 的组件都移除后,是可以编译的,可以找到。如果要使用配置好的 led_indicator 指示灯模式,请包含
include "led_indicator_blink_default.h"

dexterzeng
Posts: 12
Joined: Thu May 05, 2022 1:37 pm

Re: unknown type name 'blink_step_t'

Postby dexterzeng » Fri Apr 28, 2023 12:03 pm

我尝试新建一个工程只放了led_indicator相关的代码,也编译不过去, 可能受到编译环境的影响,继续折腾。。。

Who is online

Users browsing this forum: No registered users and 17 guests