1

编译我的项目时,出现错误,我对此错误一无所知

In file included from /home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/fmt/fmt.h:22:0,
                 from /home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/common.h:36,
                 from /home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/spdlog.h:12,
                 from ./src/common/log/Cspdlog.h:6,
                 from ./src/include/comm_function.h:15,
                 from ./src/common/table/TableBase.h:5,
                 from ./src/common/table/TableUser.h:3,
                 from ./src/common/sql/RiCiDB.h:3,
                 from ./src/common/wifi/wifiscan.cpp:3:
/home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/fmt/bundled/core.h: In instantiation of 'fmt::v8::detail::value<Context> fmt::v8::detail::make_arg(const T&) [with bool IS_PACKED = true; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; fmt::v8::detail::type <anonymous> = (fmt::v8::detail::type)15; T = iw_quality; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]':
/home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/fmt/bundled/core.h:1694:69:   required from 'fmt::v8::format_arg_store<Context, Args>::format_arg_store(const Args& ...) [with Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; Args = {int, int, iw_quality, int, int}]'
/home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/fmt/bundled/core.h:1710:18:   required from 'constexpr fmt::v8::format_arg_store<Context, Args ...> fmt::v8::make_format_args(const Args& ...) [with Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; Args = {int, int, iw_quality, int, int}]'
/home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/logger.h:285:97:   required from 'void spdlog::logger::log_(spdlog::source_loc, spdlog::level::level_enum, const FormatString&, Args&& ...) [with FormatString = char [43]; Args = {int&, int&, iw_quality&, int&, int&}; Char = char; typename std::enable_if<(! std::is_same<Char, wchar_t>::value), Char>::type* <anonymous> = 0u]'
/home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/logger.h:83:9:   required from 'void spdlog::logger::log(spdlog::source_loc, spdlog::level::level_enum, const FormatString&, Args&& ...) [with FormatString = char [43]; Args = {int&, int&, iw_quality&, int&, int&}]'
./src/common/wifi/wifiscan.cpp:737:7:   required from here
/home/wingto/work/openwrt-sdk-g001/package/utils/ricigw/src/../../../..//staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include/spdlog/fmt/bundled/core.h:1567:3: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
   static_assert(
   ^

4

1 回答 1

0

该错误意味着将不可格式化的对象传递给格式化函数。错误消息显示参数是:

Args = {int&, int&, iw_quality&, int&, int&}

由于int是可格式化的,这意味着这iw_quality是有问题的类型。要解决此问题,请添加formatter专业化iw_quality

template <>
struct fmt::formatter<iw_quality> { ... };

有关如何实现formatter.

于 2022-03-01T23:30:28.267 回答