Search code examples
c++ubuntugdbsdlremote-debugging

SDL driver fails when starting debug session on remote linux


On Win10, I have a visual studio c++ project for linux that uses the SDL2 driver. The target machine is a VirtualBox - Ubuntu 18.04.

I configured Visual studio to compile remotely on the target system, which works fine. Running the output file from console on the remote machine shows that SDL uses the XServer:

SDL_GetCurrentVideoDriver: x11

When I start debugging from visual studio (starts GNU debugger gdb on remote side):

SDL_Init error: No available video device
SDL_GetCurrentVideoDriver: null

starting gdb from remote anyway works as expected:

gdb ./myProgram
(gdb) run

But this doesn't let me debug in visual studio, which i'm looking forward to. Any idea ?


Solution

  • In Project Settings:

    Configuration Properties -> Debugging -> Pre-Launch Command -> export DISPLAY=:0