Esp8266 esp12e: what printf format specifier is used for uint32_t, aka "unsigned int"

I am trying to compile a c++ program for esp8266 on the pio ide in vscode. I need to use printf with uint32_t, aka a long unsigned int . I have googled extensively and have tried many specifiers and I can’t find any that work. It compiles ok but I get a warning like this …

warning: format '%lu' expects argument of type 'long unsigned int', 
but argument 4 has type 'uint32_t' {aka 'unsigned int'} [-Wformat=]  

I’ve tried %u, %lu, %d, %ld, and none work. What specifier should I use?

What about the PRIu32 macro? c - printf format specifiers for uint32_t and size_t - Stack Overflow

I tried that.

If that is is true you should be able to use %u and cast the variable you’re printing to (unsigned).

I’ve been doing that by casting to (unsigned long int) which was a real pita with 6 or 7 variables. (unsigned) is less painful. I guess I’ll use that. But there must be a proper specifier for each standard type. If not it’s a bug as far as I’m concerned.

Generally, it is convenient and efficient to use the default int whenever possible. I tested with NodeMcuv2 which is 8266EX. “Long unsigned int” and “unsigned” are both 4 bytes.

struct {
   unsigned v1;			// default 4 bytes
   long unsigned int v2;	// also 4 bytes
}my{1234,4321};

Serial.printf("size int %u, size long %u\r\n",
		 sizeof(my.v1),sizeof(my.v2));
   
Serial.printf("%u, %lu\r\n",my.v1, my.v2);
   
Serial.println(String(my.v1) + "\t" + String(my.v2));

But I really like to use the standards like uint32_t.

Oh well, I guess I can redefine uint32_t. Not a good thing to do but if it’s my only choice to avoid the warnings and casting.