Skip to content

Apple Clang doesn't support C++20 std::format_string #1643

@vyskocil

Description

@vyskocil

When trying to compile the latest code I got the following error, I searched a bit a read that Apple Clang does not support std::format_string from c++20, even when adding the following lines in CMakelists.txt:

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
[ 62%] Building CXX object libosmscout/CMakeFiles/OSMScout.dir/src/osmscout/util/Progress.cpp.o
In file included from /Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/src/osmscout/util/Progress.cpp:20:
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:64:23: error: no template named 'format_string' in namespace 'std'
    void SetStep(std::format_string<Args...> format, Args&& ...args)
                 ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:70:25: error: no template named 'format_string' in namespace 'std'
    void SetAction(std::format_string<Args...> format, Args&& ...args)
                   ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:76:21: error: no template named 'format_string' in namespace 'std'
    void Debug(std::format_string<Args...> format, Args&& ...args)
               ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:82:20: error: no template named 'format_string' in namespace 'std'
    void Info(std::format_string<Args...> format, Args&& ...args)
              ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:88:23: error: no template named 'format_string' in namespace 'std'
    void Warning(std::format_string<Args...> format, Args&& ...args)
                 ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:94:21: error: no template named 'format_string' in namespace 'std'
    void Error(std::format_string<Args...> format, Args&& ...args)
               ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:66:20: error: no member named 'vformat' in namespace 'std'
      SetStep(std::vformat(format.get(), std::make_format_args(args...)));
              ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:66:47: error: no member named 'make_format_args' in namespace 'std'
      SetStep(std::vformat(format.get(), std::make_format_args(args...)));
                                         ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:72:28: error: no member named 'vformat' in namespace 'std'
      this->SetAction(std::vformat(format.get(), std::make_format_args(args...)));
                      ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:72:55: error: no member named 'make_format_args' in namespace 'std'
      this->SetAction(std::vformat(format.get(), std::make_format_args(args...)));
                                                 ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:78:24: error: no member named 'vformat' in namespace 'std'
      this->Debug(std::vformat(format.get(), std::make_format_args(args...)));
                  ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:78:51: error: no member named 'make_format_args' in namespace 'std'
      this->Debug(std::vformat(format.get(), std::make_format_args(args...)));
                                             ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:84:23: error: no member named 'vformat' in namespace 'std'
      this->Info(std::vformat(format.get(), std::make_format_args(args...)));
                 ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:84:50: error: no member named 'make_format_args' in namespace 'std'
      this->Info(std::vformat(format.get(), std::make_format_args(args...)));
                                            ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:90:26: error: no member named 'vformat' in namespace 'std'
      this->Warning(std::vformat(format.get(), std::make_format_args(args...)));
                    ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:90:53: error: no member named 'make_format_args' in namespace 'std'
      this->Warning(std::vformat(format.get(), std::make_format_args(args...)));
                                               ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:96:24: error: no member named 'vformat' in namespace 'std'
      this->Error(std::vformat(format.get(), std::make_format_args(args...)));
                  ~~~~~^
/Users/vyskocil/Dev/libosmscout-vyskocil/libosmscout/include/osmscout/util/Progress.h:96:51: error: no member named 'make_format_args' in namespace 'std'
      this->Error(std::vformat(format.get(), std::make_format_args(args...)));
                                             ~~~~~^
18 errors generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildFor issues in the context of building the software

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions