Errors in esp_log while Compiling

sumati2000
Posts: 6
Joined: Tue Jan 09, 2024 8:12 pm

Errors in esp_log while Compiling

Postby sumati2000 » Thu Jun 27, 2024 2:22 pm

Hello,

I am using esp-idf extension on VsCode and was able to flash my board using the blink example. However, now, using a different code, I am getting errors in esp_log.h:

C:/Espressif/esp-idf-v5.2.2/components/log/include/esp_log.h:291:27: error: format '%d' expects argument of type 'int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
291 | #define LOG_COLOR(COLOR) "\033[0;" COLOR "m"

I am getting multiple format errors. Why would this be happening? Since these are libraries provided by ESP.

Is there a way I can remove "-Werror=format=" flag? Should I?

leschge
Posts: 36
Joined: Fri May 06, 2022 1:38 pm

Re: Errors in esp_log while Compiling

Postby leschge » Thu Jun 27, 2024 3:12 pm

uint32 (long int) must be printed with %ld. Instead of using compiler flags its better to adjust the failing %d formats.
I am using IDF 5.0.1 where there are no errors. So you shouldnt get any errors with newer versions.

MicroController
Posts: 1552
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Errors in esp_log while Compiling

Postby MicroController » Thu Jun 27, 2024 3:31 pm

And if you don't want to bother with (platform-specific) integer formatting strings, you can #include <inttypes.h> and use the macros it provides, like

Code: Select all

ESP_LOGI(TAG, "u32 value = " PRIu32 ", s8 value = " PRId8 , my_uint32, my_int8);

sumati2000
Posts: 6
Joined: Tue Jan 09, 2024 8:12 pm

Re: Errors in esp_log while Compiling

Postby sumati2000 » Thu Jun 27, 2024 4:01 pm

@leschge I went ahead and changed all the errors manually and now I have "Linking CXX executable UVC-Copy.elf
FAILED: UVC-Copy.elf" error where UVC-Copy is my project name

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot], ShinyGlossy and 217 guests