How to fix ESP32 error: 'ESP_LOGE' was not declared in this scope

Problem:

When trying compile your ESP32 project, you see an error message such as

example.txt
.pio/libdeps/esp32dev/HumanESPHTTP/src/QueryURLParser.cpp:29:9: error: 'ESP_LOGE' was not declared in this scope
         ESP_LOGE("Query URL parser", "parsing URL");
         ^~~~~~~~

Solution

At the top of the file where the error occurs (QueryURLParser.cpp in this example), add the following line:

example.cpp
#include <esp_log.h>

 

 


Check out similar posts by category: C/C++, ESP8266/ESP32