Cannot build and debug because the active file is not a C, or C++ file
12:13 14 Jan 2026

I encounter this error where I try to compile any C++ file, but I encounter the program crashing and not compiling, and I am not entirely sure what to fix in tasks.json. This is my tasks.json, and the terminal says the file isn't in C or C++, even though it has the extension of .cpp

    {"tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:/Strawberry/c/bin/gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:/Strawberry/c/bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

c++