I want to use <format> lib in my program to format the output
#include <format>// matrix displaytemplate<typename T>void algebra::display(const algebra::MATRIX<T> &matrix) { for (const auto& row : matrix) { std::cout << "|"; for (const auto& elem : row) { std::cout << std::format("{:^7}", elem) << "|"; } std::cout << "\n"; }}
However, the compiler throws an error:
fatal error: format: No such file or directory11 | #include <format> | ^~~~~~~~compilation terminated.
I have set the c++ version in the CMakeLists.txt:
# Specify the minimum required version of CMake for this project. cmake_minimum_required(VERSION 3.14)project(AUT_AP_2024_SPRING_HW1)set(CMAKE_CXX_STANDARD 23)set(CMAKE_CXX_STANDARD_REQUIRED ON)
And I have checked the version of gcc, it is satisfied the requirement for <format>.