'Can't compile program when `opencv(c++)` code is added in vs Code

This is my program:

#include<iostream>
#include<D:\installation folder\opencv\build\include\opencv2\opencv.hpp>

using namespace cv;
using namespace std;
int main()
{
Mat image;//**LOOK HERE**---(1)
// if ( !image.data )
// {
//     printf("No image data \n");
//     return -1;
// }
// namedWindow("Display Image", WINDOW_AUTOSIZE );
// imshow("Display Image", image);
// waitKey(0);

cout << "executed" << endl;
return 0;

}

Whenever I comment line-(1), program is compiled and ran successfully. But whenever I uncomment any opencv-code inside main() program is not compiled and vsCode shows error like

main.exe doesn't exists.

I don't know where is the problem. I am new in openCV. I am using vsCode and gcc-compiler. If you need more info, let me know in comment
Extra:task.json

{
"version": "2.0.0",
"tasks": [
    {
        "type": "shell",
        "label": "g++.exe build active file",
        "command": "D:\\installation folder\\mingw64\bin\\g++.exe",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "-I",
            "D:\\installation folder\\OpenCV-MinGW-Build-OpenCV-4.5.5-x64\\include",
            "-L",
            "D:\\installation folder\\OpenCV-MinGW-Build-OpenCV-4.5.5-x64\\x64\\mingw\\bin",
            "-llibopencv_calib3d411",
            "-llibopencv_core411",
            "-llibopencv_dnn411",
            "-llibopencv_features2d411",
            "-llibopencv_flann411",
            "-llibopencv_highgui411",
            "-llibopencv_imgcodecs411",
            "-llibopencv_imgproc411",
            "-llibopencv_ml411",
            "-llibopencv_objdetect411",
            "-llibopencv_photo411",
            "-llibopencv_stitching411",
            "-llibopencv_video411",
            "-llibopencv_videoio411"
        ],
        "options": {
            "cwd": "D:\\installation folder\\mingw64\\x86_64-w64-mingw32\\bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": "build"
    },
    {
        "type": "cppbuild",
        "label": "C/C++: g++.exe build active file",
        "command": "D:\\installation folder\\mingw64\\bin\\g++.exe",
        "args": [
            "-fdiagnostics-color=always",
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe"
        ],
        "options": {
            "cwd": "${fileDirname}"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Task generated by Debugger."
    }
]

}
Terminal:
terminal screen



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source