The preLaunchTask 'C/C++:gcc.exe build active file' terminated with exit code -1 Error

88 views Asked by At

When I tried to run this C code in Visual Studio Code:

#include <stdio.h>

int main() {

    int num, i = 0, lowest;

    int array[10];

    while(i != 10) 
    {
        printf("Please write %d. integer.\n\n", i);
        if(scanf("%d", &num) == 1) {
            i = i + 1;
             // Clear the input buffer
            while (getchar() != '\n');
            continue; // Restart the loop
            
            if(i == 1) {
                lowest = num;
            } else if(lowest > num || lowest == num) {
                lowest = num;
            }
        }
       
    }
    
    printf("Lowest number in array is %d. ", lowest);

    return 0;
}

It says: The preLaunchTask 'C/C++:gcc.exe build active file' terminated with exit code -1

and I selected "Debug anyway". Also this one doesn't solves my problem.

I expect to my program work but it didn't worked for some reasons. I thought it was about mingw but I already installed that.

0

There are 0 answers