The prelaunchtask c/c++ :gcc.exe build active file terminated with exit code -1

140 Views Asked by At
#include<iostream>
using namespace std;

int main()
{
    int a[10][10], b[10][10], null[10][10];
    int r, c;
    cout << "Enter the number of rows"<< endl;
    cin >> r;
    cout << "Enter the number of colums" << endl;
    cin >> c;

    cout<< "Enter the elements of the first matrix : " <<endl;
    
    //get the first elements
    for(int i{0}; i < r; i++)
    {
        for(int j{0}; j < c; j++)
        {
            cin >> a[i][j];
        }
    }
    cout << "Enter the second elements : " <<endl;
    //get the second elements

    for(int i{0}; i < r; i++)
    {
        for(int j{0}; j < c; j++)
        {
            cin >> b[i][j];
        }
    }

    //multiply the result
    for(int i{0}; i < r; i++)
    {
        for(int j{0}; j < c; j++){
            null[i][j] = 0;
            for(int k{0}; k < c; k++)
            {
                null[i][j] = null[i][j] + a[i][k] * b[k][j];
            }
        }
    }

    cout << "the result of the multiplication is : " << endl;
    for(int i{0}; i < r; i++)
    {
        for(int j{0}; j < c; j++)
        {
            cout << null[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

in this code while debugging i see error like

The prelaunchtask C/C++ build active file terminated with exit code -1. and it also show me this error on the terminal

C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\User\AppData\Local\Temp\ccnp23Hv.o:matrix.cpp:(.rdata$.refptr._ZSt4cout[.refptr._ZSt4cout]+0x0): undefined reference to `std::cout'

collect2.exe: error: ld returned 1 exit status

Build finished with error(s).

* The terminal process terminated with exit code: -1.

my code is running in the termina. can anyone help me how to solve that problem?

0

There are 0 best solutions below