请问为什么这个矩阵转置代码在VS code中运行会报错,用VS2019验证可以跑出来

学习C++编写了一个简单的将5*3矩阵转置的程序,在VS code运行一直出错,重启VS code问题依然存在,换到VS Studio 2019中可以跑出来,不知为何?

#include<iostream>
int main(){
    using namespace std;
    int matrix[5][3]=
    {
        {1,2,3},
        {4,5,6},
        {7,8,9},
        {10,11,12},
        {13,14,15}
    };
    cout<<"转置后的矩阵是:\n";
    for(int rows=0;rows<3;rows++){
        for(int cols=0;cols<5;cols++)
            cout<<matrix[cols][rows]<<"\t";
        cout<<endl;
    }
    return 0;
}

 ###### 运行结果及报错内容
VS code:

img

VS Studio 2019:

img

 ###### 我的解答思路和尝试过的方法

 ###### 我想要达到的结果

vscode G++配了么?