MarcoBramini / screen-recorder

A library to capture and record your audio and video devices
GNU General Public License v3.0
10 stars 3 forks source link

error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: #6

Closed xkungxfu closed 1 year ago

xkungxfu commented 1 year ago
/// Finds the main video stream in the current device context.
int DeviceContext::find_main_stream(AVMediaType streamType) {
  // Build method params for error handling purposes
  std::map<std::string, std::string> methodParams = {
      {"streamType", std::to_string(streamType)}};

  if (avfc == nullptr) {
    throw std::runtime_error(Error::build_error_message(
        __FUNCTION__, methodParams, "device not initialized"));
  }

  int streamIndex =
      av_find_best_stream(avfc.get(), streamType, -1, -1, nullptr, 0);
  if (streamIndex < 0) {
    throw std::runtime_error(Error::build_error_message(
        __FUNCTION__, methodParams,
        fmt::format("error finding main stream for type {}", streamType)));
  }

  return streamIndex;
}
device_context.cpp:152:21: In template: call to deleted constructor of 'formatter<mapped_type, char_type>' (aka 'formatter<AVMediaType, char>')
core.h:2567:10: error occurred here
core.h:2626:23: in instantiation of function template specialization 'fmt::detail::parse_format_specs<AVMediaType, fmt::detail::compile_parse_context<char>>' requested here
core.h:2775:47: in instantiation of member function 'fmt::detail::format_string_checker<char, AVMediaType>::format_string_checker' requested here
device_context.cpp:152:21: in instantiation of function template specialization 'fmt::basic_format_string<char, AVMediaType &>::basic_format_string<char[38], 0>' requested here
core.h:792:3: 'formatter' has been explicitly marked deleted here

/vcpkg-2023.06.20/packages/fmt_x64-windows/include/fmt/core.h:1691:7: 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
 1691 |       formattable,
MarcoBramini commented 1 year ago

Sadly the fmt library got updated and i didn't set a specific version in the install commands. I will address this as soon as i have time to! Thanks for letting me know.

This seems to be related to #5. I'm closing this one and leave the other open for any follow-up.