spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

Error: ‘fmt::v11::detail::type_is_unformattable_for<XTP_POSITION_DIRECTION_TYPE, char> _’ has incomplete type when using spdlog headers

Open shilkazx opened this issue 11 months ago • 4 comments

System Archlinux x64 GCC 14.2.1 cmake 3.31.5

Spdlog I use git clone get latest version

Bug details Error occurred when I compile another project which need spdlog headers. The cmake result is:

......
***.cpp:495:33:   required from here
  495 |                         std::string key = fmt::format("{}-{}", code.c_str(), position->position_direction);
/git/spdlog/include/spdlog/fmt/bundled/base.h:2235:45: error: ‘fmt::v11::detail::type_is_unformattable_for<XTP_POSITION_DIRECTION_TYPE, char> _’ has incomplete type
 2235 |     type_is_unformattable_for<T, char_type> _;

shilkazx avatar Feb 02 '25 14:02 shilkazx

Please provide code to reproduce and compiler info

gabime avatar Feb 02 '25 18:02 gabime

Please provide code to reproduce and compiler info

I'm sorry that I'm not a c++ expert/daily user, and I'd not use spdlog before. So I need more time to study and write a POC.

shilkazx avatar Feb 03 '25 13:02 shilkazx

I had this issue a little bit ago. For me, I noticed it was an error related to passing a std::filesystem::path as an argument. So, as a workaround/fix, I just got the c_str() from the path instead. I assume its something similar in your case @shilkazx

Alriightyman avatar Mar 01 '25 04:03 Alriightyman

See https://fmt.dev/11.1/api/#std-api , spdlog uses fmt under the hood, and fmt by default doesn't include support for everything to reduce compile times. #include <fmt/std.h> before spdlog fixed this for me.

JWCS avatar Mar 26 '25 18:03 JWCS