Search code examples
c++gccfmt

Format no such file or directory


I was trying to use the C++ format utility (std::format). I tried to compile this simple program:

#include <format>

int main()
{
   std::cout << std::format("{}, {}", "Hello world", 123) << std::endl;

   return 0;
}

When I try compiling with g++ -std=c++2a format_test.cpp, it gives me this:

format_test.cpp:1:10: fatal error: format: No such file or directory
    1 | #include <format>
      |

I have got GCC 10.2.0


Solution

  • Finally, std::format is now supported in gcc 13.1 version! https://godbolt.org/z/TW9G8Gh5Y