Imshow not showing the image window (VS Code)

#include <stdio.h>
#include<opencv2/opencv.hpp>

using namespace cv;

int main(int argc, char** argv) {
    Mat image;
    image = imread("D:/opencvproj/Trial/Elephant.jpg");
    if(!image.data)
    {
     printf("No image data \n");
     return -1;   
    }
    namedWindow("Display Image", WINDOW_AUTOSIZE);
    imshow("Display Image", image);
    waitKey(0);
    return 0;
}

After building, in the output

[main] Building folder: opencvproj
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/opencvproj/build --config Debug --target ALL_BUILD -j 10 --
[build] Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build]
[build] Checking Build System
[build] Building Custom Rule D:/opencvproj/CMakeLists.txt
[build] main.cpp
[build] D:\opencvproj\main.cpp(8,20): warning C4129: 'o': unrecognized character escape sequence [D:\opencvproj\build\OpenCVTest.vcxproj]
[build] D:\opencvproj\main.cpp(8,20): warning C4129: 'T': unrecognized character escape sequence [D:\opencvproj\build\OpenCVTest.vcxproj]
[build] D:\opencvproj\main.cpp(8,20): warning C4129: 'E': unrecognized character escape sequence [D:\opencvproj\build\OpenCVTest.vcxproj]
[build] OpenCVTest.vcxproj -> D:\opencvproj\build\Debug\OpenCVTest.exe
[build] Building Custom Rule D:/opencvproj/CMakeLists.txt
[build] Build finished with exit code 0
[main] Building folder: opencvproj OpenCVTest
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build d:/opencvproj/build --config Debug --target OpenCVTest -j 10 --
[build] Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
[build] Copyright (C) Microsoft Corporation. All rights reserved.
[build]
[build] OpenCVTest.vcxproj -> D:\opencvproj\build\Debug\OpenCVTest.exe
[build] Build finished with exit code 0

run, in Terminal:

PS D:\opencvproj\build\Debug> ."D:/opencvproj/build/Debug/OpenCVTest.exe"
PS D:\opencvproj\build\Debug>

Are you sure that this is your actual source code? The warnings suggest that your image’s path uses backslashes, resulting in escape sequences \o and \T and a path that is wrong…

not an OpenCV issue.

all beginners have trouble grasping how paths work. this just results in issues with whatever APIs you call that expect you to understand paths.