SDL2 Window Not Showing Up from Remote Debug

Am attempting to create a simple GUI window on the Raspberry Pi using SDL2 but although SDL2 is implying everything is ok I’m not getting a window displayed with the code below.

I can place a breakpoint within the main loop and it is hit when the programme is running.

I located the *.out file created from the build process and executed this from within the Raspberry Pi OS GUI (double click and select either “Execute” or “Execute In Terminal”) and the window appears as expected.
Also if I execute the above out file from a local terminal, opened from within the Raspberry Pi OS, using the command ./app.out it creates and displays the window.

If however I execute the same file from a remote terminal then nothing appears yet the process is still running.

Configuration/Setup is:
Raspberry Pi 3 Model 3
Raspberry Pi OS (Debian Bullseye with Raspberry Pi Desktop)
SDL2 installed using command: sudo apt-get install libsdl2-dev
Development Environment: Visual Studio 2019, debugging over SSH.


SDL_Window* window;                    // Declare a pointer
SDL_Init(SDL_INIT_VIDEO);              // Initialize SDL2

// Create an application window with the following settings:
window = SDL_CreateWindow(
    "An SDL2 window",                  // window title
    SDL_WINDOWPOS_UNDEFINED,           // initial x position
    SDL_WINDOWPOS_UNDEFINED,           // initial y position
    640,                               // width, in pixels
    480,                               // height, in pixels
    SDL_WINDOW_OPENGL                  // flags - see below

// Check that the window was successfully created
if (window == NULL)
    // In the case that the window could not be made...
    printf("Could not create window: %s\n", SDL_GetError());
    return 1;

// A basic main loop to prevent blocking
bool is_running = true;
SDL_Event event;
while (is_running)
    while (SDL_PollEvent(&event))
        if (event.type == SDL_QUIT)
            is_running = false;

// Close and destroy the window

// Clean up
return 0;