Skip to content

ERROR: spdlog error C2338: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: #329

@SpaceView

Description

@SpaceView

Thanks for your bug report. We appreciate it a lot.

win10 + VS2019
I use cmake-gui to generate the solution and then started to compile the file, and got the following problem,
1>------ 已启动生成: 项目: mmdeploy_core, 配置: Debug x64 ------
1>tensor.cpp
1>E:\vOpenMM\mmdeploy\csrc\core/status_code.h(98): warning C4275: 非 dll 接口 class“system_error2::status_code_domain”用作 dll 接口 class“mmdeploy::StatusDomain”的基
1>E:\vOpenMM\mmdeploy\third_party\outcome\outcome-experimental.hpp(6598): note: 参见“system_error2::status_code_domain”的声明
1>E:\vOpenMM\mmdeploy\csrc\core/status_code.h(98): note: 参见“mmdeploy::StatusDomain”的声明
1>E:\vOpenMM\spdlog\include\spdlog/fmt/bundled/core.h(1728): error C2338: Cannot format an argument. To make type T formattable provide a formatter specialization: https://fmt.dev/latest/api.html#udt
1>E:\vOpenMM\spdlog\include\spdlog/fmt/bundled/core.h(1849): note: 查看对正在编译的函数 模板 实例化“fmt::v8::detail::value fmt::v8::detail::make_arg<true,Context,fmt::v8::detail::type::custom_type,mmdeploy::DataType&,0>(T)”的引用
1> with
1> [
1> Context=fmt::v8::format_context,
1> T=mmdeploy::DataType &
1> ]
1>E:\vOpenMM\spdlog\include\spdlog/fmt/bundled/core.h(1871): note: 查看对正在编译的函数 模板 实例化“fmt::v8::format_arg_storefmt::v8::format_context,mmdeploy::DataType,mmdeploy::DataType::format_arg_store<mmdeploy::DataType&,const mmdeploy::DataType&>(mmdeploy::DataType &,const mmdeploy::DataType &)”的引用
1>E:\vOpenMM\spdlog\include\spdlog/fmt/bundled/core.h(1872): note: 查看对正在编译的函数 模板 实例化“fmt::v8::format_arg_storefmt::v8::format_context,mmdeploy::DataType,mmdeploy::DataType::format_arg_store<mmdeploy::DataType&,const mmdeploy::DataType&>(mmdeploy::DataType &,const mmdeploy::DataType &)”的引用
1>E:\vOpenMM\spdlog\include\spdlog/logger.h(357): note: 查看对正在编译的函数 模板 实例化“fmt::v8::format_arg_storefmt::v8::format_context,mmdeploy::DataType,mmdeploy::DataType fmt::v8::make_format_args<fmt::v8::format_context,mmdeploy::DataType&,const mmdeploy::DataType&>(mmdeploy::DataType &,const mmdeploy::DataType &)”的引用
1>E:\vOpenMM\spdlog\include\spdlog/logger.h(89): note: 查看对正在编译的函数 模板 实例化“void spdlog::logger::log_<mmdeploy::DataType&,const mmdeploy::DataType&>(spdlog::source_loc,spdlog::level::level_enum,spdlog::string_view_t,mmdeploy::DataType &,const mmdeploy::DataType &)”的引用
1>E:\vOpenMM\mmdeploy\csrc\core\tensor.cpp(99): note: 查看对正在编译的函数 模板 实例化“void spdlog::logger::log<mmdeploy::DataType&,const mmdeploy::DataType&>(spdlog::source_loc,spdlog::level::level_enum,fmt::v8::basic_format_string<char,mmdeploy::DataType &,const mmdeploy::DataType &>,mmdeploy::DataType &,const mmdeploy::DataType &)”的引用
1>registry.cpp
1>E:\vOpenMM\mmdeploy\csrc\core/status_code.h(98): warning C4275: 非 dll 接口 class“system_error2::status_code_domain”用作 dll 接口 class“mmdeploy::StatusDomain”的基
1>E:\vOpenMM\mmdeploy\third_party\outcome\outcome-experimental.hpp(6598): note: 参见“system_error2::status_code_domain”的声明
1>E:\vOpenMM\mmdeploy\csrc\core/status_code.h(98): note: 参见“mmdeploy::StatusDomain”的声明
1>stacktrace.cpp
1>正在生成代码...
1>已完成生成项目“mmdeploy_core.vcxproj”的操作 - 失败。

currently I'm not sure whether this is a spdlog problem or a mmdeploy problem or both.
the only thing I'm sure is that this error is raised by the following sentence, in tensor.cpp.

MMDEPLOY_ERROR("mismatched data type {} vs {}", desc_.data_type, tensor.desc().data_type);

My temporary fix is make them integer,

MMDEPLOY_ERROR("mismatched data type {} vs {}", (int)desc_.data_type, (int)tensor.desc().data_type);

any better idea, please?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions