spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Can not find basic_runtime under namespace fmt

Open ThisIsBohao opened this issue 1 year ago • 1 comments

Hi,

I was using <spdlog/sinks/rotating_file_sink.h> and had the following issue. Is it because the spdlog and the fmt library start to have incompatible issues? I am using Ubuntu 22.04 and installed spdlog and fmt through "apt install". I appreciate any help on this!

In file included from /usr/include/spdlog/sinks/base_sink.h:12,
                 from /usr/include/spdlog/sinks/rotating_file_sink.h:6,
/usr/include/spdlog/common.h:127:111: error: ‘basic_runtime’ is not a member of ‘fmt’
  127 |           std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt::basic_runtime<Char>>::value>
      |                                                                                                               ^~~~~~~~~~~~~
/usr/include/spdlog/common.h:127:125: error: template argument 2 is invalid
  127 |           std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt::basic_runtime<Char>>::value>
      |                                                                                                                             ^~~~
/usr/include/spdlog/common.h:127:138: error: expected ‘{’ before ‘>’ token
  127 |           std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt::basic_runtime<Char>>::value>
      |                                                                                                                                          ^
In file included from /usr/include/spdlog/details/registry-inl.h:12,
                 from /usr/include/spdlog/details/registry.h:114,
                 from /usr/include/spdlog/details/synchronous_factory.h:6,
                 from /usr/include/spdlog/sinks/rotating_file_sink.h:9,
/usr/include/spdlog/logger.h:81:53: error: ‘fmt::format_string’ has not been declared
   81 |     void log(source_loc loc, level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args)
      |                                                     ^~~
/usr/include/spdlog/logger.h:81:71: error: expected ‘,’ or ‘...’ before ‘<’ token
   81 |     void log(source_loc loc, level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args)
      |                                                                       ^
/usr/include/spdlog/logger.h:87:37: error: ‘fmt::format_string’ has not been declared
   87 |     void log(level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args)
      |                                     ^~~
/usr/include/spdlog/logger.h:87:55: error: expected ‘,’ or ‘...’ before ‘<’ token
   87 |     void log(level::level_enum lvl, fmt::format_string<Args...> fmt, Args &&...args)
      |                                                       ^
/usr/include/spdlog/logger.h:144:16: error: ‘fmt::format_string’ has not been declared
  144 |     void trace(fmt::format_string<Args...> fmt, Args &&...args)
      |                ^~~
/usr/include/spdlog/logger.h:144:34: error: expected ‘,’ or ‘...’ before ‘<’ token
  144 |     void trace(fmt::format_string<Args...> fmt, Args &&...args)
      |                                  ^
/usr/include/spdlog/logger.h:150:16: error: ‘fmt::format_string’ has not been declared
  150 |     void debug(fmt::format_string<Args...> fmt, Args &&...args)
      |                ^~~
/usr/include/spdlog/logger.h:150:34: error: expected ‘,’ or ‘...’ before ‘<’ token
  150 |     void debug(fmt::format_string<Args...> fmt, Args &&...args)
      |                                  ^
/usr/include/spdlog/logger.h:156:15: error: ‘fmt::format_string’ has not been declared
  156 |     void info(fmt::format_string<Args...> fmt, Args &&...args)
      |               ^~~
/usr/include/spdlog/logger.h:156:33: error: expected ‘,’ or ‘...’ before ‘<’ token
  156 |     void info(fmt::format_string<Args...> fmt, Args &&...args)
      |                                 ^
/usr/include/spdlog/logger.h:162:15: error: ‘fmt::format_string’ has not been declared
  162 |     void warn(fmt::format_string<Args...> fmt, Args &&...args)
      |               ^~~
/usr/include/spdlog/logger.h:162:33: error: expected ‘,’ or ‘...’ before ‘<’ token
  162 |     void warn(fmt::format_string<Args...> fmt, Args &&...args)
      |                                 ^
/usr/include/spdlog/logger.h:168:16: error: ‘fmt::format_string’ has not been declared
  168 |     void error(fmt::format_string<Args...> fmt, Args &&...args)
      |                ^~~
/usr/include/spdlog/logger.h:168:34: error: expected ‘,’ or ‘...’ before ‘<’ token
  168 |     void error(fmt::format_string<Args...> fmt, Args &&...args)
      |                                  ^
/usr/include/spdlog/logger.h:174:19: error: ‘fmt::format_string’ has not been declared
  174 |     void critical(fmt::format_string<Args...> fmt, Args &&...args)
      |                   ^~~
/usr/include/spdlog/logger.h:174:37: error: expected ‘,’ or ‘...’ before ‘<’ token
  174 |     void critical(fmt::format_string<Args...> fmt, Args &&...args)
      |                                     ^
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, int)’:
/usr/include/spdlog/logger.h:83:27: error: expected primary-expression before ‘,’ token
   83 |         log_(loc, lvl, fmt, std::forward<Args>(args)...);
      |                           ^
/usr/include/spdlog/logger.h:83:48: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
   83 |         log_(loc, lvl, fmt, std::forward<Args>(args)...);
      |                                                ^~~~
      |                                                Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::log(spdlog::level::level_enum, int)’:
/usr/include/spdlog/logger.h:89:35: error: expected primary-expression before ‘,’ token
   89 |         log(source_loc{}, lvl, fmt, std::forward<Args>(args)...);
      |                                   ^
/usr/include/spdlog/logger.h:89:56: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
   89 |         log(source_loc{}, lvl, fmt, std::forward<Args>(args)...);
      |                                                        ^~~~
      |                                                        Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::trace(int)’:
/usr/include/spdlog/logger.h:146:30: error: expected primary-expression before ‘,’ token
  146 |         log(level::trace, fmt, std::forward<Args>(args)...);
      |                              ^
/usr/include/spdlog/logger.h:146:51: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
  146 |         log(level::trace, fmt, std::forward<Args>(args)...);
      |                                                   ^~~~
      |                                                   Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::debug(int)’:
/usr/include/spdlog/logger.h:152:30: error: expected primary-expression before ‘,’ token
  152 |         log(level::debug, fmt, std::forward<Args>(args)...);
      |                              ^
/usr/include/spdlog/logger.h:152:51: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
  152 |         log(level::debug, fmt, std::forward<Args>(args)...);
      |                                                   ^~~~
      |                                                   Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::info(int)’:
/usr/include/spdlog/logger.h:158:29: error: expected primary-expression before ‘,’ token
  158 |         log(level::info, fmt, std::forward<Args>(args)...);
      |                             ^
/usr/include/spdlog/logger.h:158:50: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
  158 |         log(level::info, fmt, std::forward<Args>(args)...);
      |                                                  ^~~~
      |                                                  Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::warn(int)’:
/usr/include/spdlog/logger.h:164:29: error: expected primary-expression before ‘,’ token
  164 |         log(level::warn, fmt, std::forward<Args>(args)...);
      |                             ^
/usr/include/spdlog/logger.h:164:50: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
  164 |         log(level::warn, fmt, std::forward<Args>(args)...);
      |                                                  ^~~~
      |                                                  Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::error(int)’:
/usr/include/spdlog/logger.h:170:28: error: expected primary-expression before ‘,’ token
  170 |         log(level::err, fmt, std::forward<Args>(args)...);
      |                            ^
/usr/include/spdlog/logger.h:170:49: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
  170 |         log(level::err, fmt, std::forward<Args>(args)...);
      |                                                 ^~~~
      |                                                 Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::critical(int)’:
/usr/include/spdlog/logger.h:176:33: error: expected primary-expression before ‘,’ token
  176 |         log(level::critical, fmt, std::forward<Args>(args)...);
      |                                 ^
/usr/include/spdlog/logger.h:176:54: error: ‘args’ was not declared in this scope; did you mean ‘Args’?
  176 |         log(level::critical, fmt, std::forward<Args>(args)...);
      |                                                      ^~~~
      |                                                      Args
/usr/include/spdlog/logger.h: In member function ‘void spdlog::logger::log_(spdlog::source_loc, spdlog::level::level_enum, spdlog::string_view_t, Args&& ...)’:
/usr/include/spdlog/logger.h:332:18: error: ‘fmt::detail’ has not been declared
  332 |             fmt::detail::vformat_to(buf, fmt, fmt::make_format_args(args...));

ThisIsBohao avatar Feb 16 '24 23:02 ThisIsBohao

Duplicate #2782

spdlog v1.11.0 and earlier are incompatible with fmt v10.

tt4g avatar Feb 17 '24 00:02 tt4g