[GH-ISSUE #1798] Compiler warning, Debug_WM, %5lu should be %5u #1514

Open
opened 2026-02-28 01:30:22 +03:00 by kerem · 2 comments
Owner

Originally created by @Dario503 on GitHub (Feb 4, 2025).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1798

.pio/libdeps/esp32-s3-wroom-N8R8/WiFiManager/WiFiManager.cpp:150:100:   required from here
.pio/libdeps/esp32-s3-wroom-N8R8/WiFiManager/WiFiManager.cpp:3405:23: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t' {aka 'unsigned int'} [-Werror=format=]
     _debugPort.printf("[MEM] free: %5lu | max: %5u | frag: %3u%% \n", free, max, frag);

Changing %5lu to %5u eliminates all -Wall warnings.

_debugPort.printf("[MEM] free: %5u | max: %5u | frag: %3u%% \n", free, max, frag);

//_debugPort.printf("[MEM] free: %5lu | max: %5u | frag: %3u%% \n", free, max, frag);

Originally created by @Dario503 on GitHub (Feb 4, 2025). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1798 ```pio/libdeps/esp32-s3-wroom-N8R8/WiFiManager/WiFiManager.cpp: In instantiation of 'void WiFiManager::DEBUG_WM(wm_debuglevel_t, Generic, Genericb) [with Generic = const __FlashStringHelper*; Genericb = unsigned int]': .pio/libdeps/esp32-s3-wroom-N8R8/WiFiManager/WiFiManager.cpp:150:100: required from here .pio/libdeps/esp32-s3-wroom-N8R8/WiFiManager/WiFiManager.cpp:3405:23: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t' {aka 'unsigned int'} [-Werror=format=] _debugPort.printf("[MEM] free: %5lu | max: %5u | frag: %3u%% \n", free, max, frag); ``` Changing %5lu to %5u eliminates all -Wall warnings. `_debugPort.printf("[MEM] free: %5u | max: %5u | frag: %3u%% \n", free, max, frag);` `//_debugPort.printf("[MEM] free: %5lu | max: %5u | frag: %3u%% \n", free, max, frag);`
Author
Owner

@amcewen commented on GitHub (May 21, 2025):

Which version of the ESP-IDF is that on? The %5u version used to build okay for me for ESP32S3 on ESP-IDF v4.4.6, but after switching to v5.3.3 I need the %5lu version for it to build.

Maybe the suggestion in this comment would fix it for both possibilities?

<!-- gh-comment-id:2898376687 --> @amcewen commented on GitHub (May 21, 2025): Which version of the ESP-IDF is that on? The `%5u` version used to build okay for me for ESP32S3 on ESP-IDF v4.4.6, but after switching to v5.3.3 I need the `%5lu` version for it to build. Maybe the [suggestion in this comment](https://github.com/tzapu/WiFiManager/pull/1740#issuecomment-2847832604) would fix it for both possibilities?
Author
Owner

@Nirab123456 commented on GitHub (Nov 16, 2025):

Lol maintainer is dead..... still same issue (anyone if needed just replace the line or remove)

_debugPort.printf("[MEM] free: %5lu | max: %5lu | frag: %3lu%% \n",
static_cast(free),
static_cast(max),
static_cast(frag));

<!-- gh-comment-id:3539438772 --> @Nirab123456 commented on GitHub (Nov 16, 2025): Lol maintainer is dead..... still same issue (anyone if needed just replace the line or remove) _debugPort.printf("[MEM] free: %5lu | max: %5lu | frag: %3lu%% \n", static_cast<unsigned long>(free), static_cast<unsigned long>(max), static_cast<unsigned long>(frag));
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1514
No description provided.