0

I'm getting an issue when only using G++ with the format library included in C++20 and onwards, I have included the library (#include <format>) however, G++ returns "No such file or directory", therefore it terminates the compilation...

However using cl (msvc), it works, could it be that the format library is not added yet to g++, or am i doing something wrong?

CLI Command: g++ -std=c++2a main.cpp

Code:

#include <format>

void StartThread() {
// Notification
    std::string start = std::format("Starting Thread ID: {}\n", std::this_thread::get_id());
    std::cout << start;

    ... // Unrequired Code below
}
main.cpp:5:10: fatal error: format: No such file or directory
    5 | #include <format>
      |          ^~~~~~~~
compilation terminated. 

Any help would be appreciated tyyy

BruhRain
  • 1
  • 2
  • According to [cppreference](https://en.cppreference.com/w/cpp/compiler_support), `` is only implemented in libc++ and MSVC-STL. Either you have to switch compilers, or you have to wait. – 康桓瑋 May 31 '22 at 16:44
  • Or you can [use libfmt directly](https://github.com/fmtlib/fmt). The free library has already surpassed what is promised in the C++20 standard lib. – Drew Dormann May 31 '22 at 16:47
  • Thank for the help, i'll consider this and test what's a better option for me to use – BruhRain May 31 '22 at 22:17

0 Answers0