如何用visualstudio2022编写c++代码,使用std::format编译运行时出现debugerror abort() has been called

用visual studio 2022编写c++代码,使用std::format编译运行时出现debugerror abort() has been called

#include <iostream>
#include <format>


int main() {
    int num = _MSC_VER; // get the version
    std::cout << std::format("My MSVC version is:{ }", num);
    return 0;
}

img

                                                                                                                                         
  Debug Error!
   Program:C:\VisualStudio\workplacelProject2\x64DebugProject2.exe
     abort() has been called
   (PressRetry todebug theapplication)

c++版本为 std/c++ latest

这种情况该如何解决?

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^

代码并没有问题,程序能够正常运行。报错可能在其他的地方。
另外 **My MSVC version is:{ }**,大括号中间去掉空格{},或者{0}。