How to fix ESP32 error: 'gpio_num_t' does not name a type

Problem:

When compiling an ESP32 project, you may encounter the following error message:

include/Pins.hpp:10:11: error: 'gpio_num_t' does not name a type
 constexpr gpio_num_t Pin_WS2812_Data = GPIO_NUM_37;

Solution

You just need to include hal/gpio_types.h before the first use of gpio_num_t in the file (typically, at the top of the file where the other includes are located):

#include <hal/gpio_types.h>