You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: cannot pass object of non-trivial type 'std::basic_string' through variadic function; call will abort at runtime [-Wnon-pod-varargs]
int size_s = std::snprintf(nullptr, 0, format_str, args...) + 1; // "\0"
error: cannot pass object of non-trivial type 'std::basic_string' through variadic function; call will abort at runtime [-Wnon-pod-varargs] int size_s = std::snprintf(nullptr, 0, format_str, args...) + 1; // "\0"
error: cannot pass object of non-trivial type 'std::basic_string' through variadic function; call will abort at runtime [-Wnon-pod-varargs]
int size_s = std::snprintf(nullptr, 0, format_str, args...) + 1; // "\0"
我在make时候遇到了这个错误,gpt解释是snprinf不能接受非平凡类型,args无法提供保证。提供给我的解决方案是把args先转成string再转成const char*。修改后完成了编译
std::ostringstream oss;
(oss << ... << args);
int size_s = std::snprintf(nullptr, 0, format_str, oss.str().c_str()) + 1; // "\0"
这个编译错误是我的环境引起的吗?
The text was updated successfully, but these errors were encountered: