vscode远程连接linux调试GUI程序
参考:https://zhuanlan.zhihu.com/p/385276301
其中遇到的坑:(是否必须这样值得研究,这是多次尝试成功的结果)
安装VcXsrv
启动时设置DISPLAY为10
后面把禁止访问控制勾上
VSCODE的SSH连接配置里设置:
Host 192.168.1.233
HostName 192.168.1.233
User haosou
ForwardX11 yes
ForwardX11Trusted yes
在VSCODE打开的控制台里:
export DISPLAY=192.168.1.234:10.0
其中192.168.1.234是VSCODE主机的IP。
lanch.json中命令行参数只能一行一个参数,如-s 10022要分为两行,否则被视为一个串,导致出错。
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Debug",
"type": "cppdbg",
"request": "launch",
"program": "/home/haosou/work/ktd/build/src/lvd/lvd",
"args": [
"-s",
"10022",
"-h",
"127.0.0.1",
"-p",
"0",
"--respath",
"/home/haosou/work/ktd/res/ktd",
"--ktd-type",
"udp",
"--ktd-ip",
"127.0.0.1",
"--ktd-port",
"17789",
"--ktd-local-port",
"17788"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"preLaunchTask": "",
"environment": [ ],
"externalConsole": false,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
}
]
}