Search code examples
linuxvisual-studiox11x11-forwarding

X11 forward ssh Visual studio remote connection


I’am able to compile and build a Linux application remotely to a raspberry pi. It would help me if I can debug aswell.

The problem is when I try to debug with visual studio and just before the application is about to launch I get the following error:

Error: Unable to initialize gtk, is DISPLAY set properly?

I am aware that it has something to do with remotely starting a graphical application. A solution would be to start the ssh connection with -X or -Y parameter.

Unfortunately Visual Studio doesn’t let me add arguments in the ssh connection.

Is there a way to add those arguments?


Solution

  • I figured it out and I'am able to debug a GUI application remotely from Visual Studio to a Linux machine(Raspberry PI).

    The remote machine has to know on what display the application to run.

    Add export DISPLAY=:0.0 to the Configuration Properties–>Debugging–>Pre-Launch Command setting so the Linux machine knows which display to show the window on.