How to Print uint64_t in Arduino
The Arduino programming language looks like C++, but it is weird in its own way: there's no C++ standard library.
In C++, you can print a variable to the debug console with std::cerr << x;.
In Arduino, you have to write a function call: Serial.print(x);.
I love that the Streaming library brings back the familiar syntax Serial << x; through some template and macro magic.
But when it comes to a uint64_t variable, nothing works!
error: call of overloaded 'print(uint64_t&)' is ambiguous
Serial.print(x);
^
note: candidates are:
note: size_t Print::print(const __FlashStringHelper*) <near match>
note: no known conversion for argument 1 from 'uint64_t {aka long long unsigned int}' to 'const __FlashStringHelper*'
note: size_t Print::print(const String&) <near match>
note: no known conversion for argument 1 from 'uint64_t {aka long long unsigned int}' to 'const String&'The cause of this error is: Arduino does not know how to print a uint64_t!
How Arduino Prints Stuff
Arduino contains a subset of C++ standard library, plus some additional headers known as the "Arduino Core".
Each microcontroller has its own Arduino Core: AVR, SAMD, ESP8266, ESP32.
They follow roughly the same API, one of which is the Print class that knows how to print stuff.





