ESP_LOGI and ESP_ERROR_CHECK issues in C++
Posted: Sun Nov 26, 2023 3:06 pm
Hi, I've been chasking this for a while. It's not an issue that affects generated code, but rather produces lots of annoying "errors" in the IDE. I've narrowed it down to a trivial main.cpp program:
This program (Without the extern "C") does not show any IDE errors when written as main.c
The ESP_LOGI macro shows a simple "Syntax Error" in the IDE.
The ESP_ERROR_CHECK shows an "Invalid Argumements" error, or sometimes in a bigger program an error that "__ASSERT not found"
I don't mind re-codeing the logging macro to:
But I can't find a way around the ERROR check macro, and it's used a lot in sample code, and I would like to keep this. Anyone know a workaround?
This program (Without the extern "C") does not show any IDE errors when written as main.c
Code: Select all
#include "esp_log.h"
#include "esp_err.h"
#include "esp_err.h"
#include "nvs_flash.h"
extern "C" {
void app_main(void) {
ESP_LOGI("XXX", "YYY");
ESP_ERROR_CHECK(nvs_flash_init());
}
}
The ESP_LOGI macro shows a simple "Syntax Error" in the IDE.
The ESP_ERROR_CHECK shows an "Invalid Argumements" error, or sometimes in a bigger program an error that "__ASSERT not found"
I don't mind re-codeing the logging macro to:
Code: Select all
esp_log_write(ESP_LOG_INF", "Blah","Blah");