如何修复 ESP32 错误:'gpio_num_t' does not name a type
问题:
编译 ESP32 项目时,你可能会遇到以下错误消息:
gpio_include_fix.cpp
include/Pins.hpp:10:11: error: 'gpio_num_t' does not name a type
constexpr gpio_num_t Pin_WS2812_Data = GPIO_NUM_37;解决方案
你只需要在文件中首次使用 gpio_num_t 之前包含 hal/gpio_types.h(通常在文件顶部其他 include 所在的位置):
include_gpio_types_example.cpp
#include <hal/gpio_types.h>If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow