If you are encountering an error like:
fatal error: format: No such file or directory 1 | #include <format> | ^~~~~~~~
That is because your compiler gcc is an older version. You can solve it by installing libfmt-dev:
sudo apt update sudo apt install libfmt-dev
Then to include this into your software, instead of writing
#include <format>
you need to use the following two(!) lines:
#define FMT_HEADER_ONLY #include <fmt/format.h>
You can test this with the following program:
#define FMT_HEADER_ONLY #include <fmt/format.h> #include <iostream> using fmt::v6::print; // Use this rather than std::format using std::cout; int main() { cout << "The tenth prime is\n"; print("hello world!\n"); }