gpt4 book ai didi

c++ - 如何在VSCODE中调试带有 "sudo"的程序

转载 作者:太空狗 更新时间:2023-10-29 15:05:23 32 4
gpt4 key购买 nike

我正在尝试在 VSCODE 中调试程序。该程序需要以 root 身份或在 Ubuntu 上使用“sudo”启动。实现这一目标的最佳方法是什么?示例启动配置会有所帮助。谢谢。

最佳答案

我最近也遇到过类似的情况-我通过在 .vscode 目录下的 launch.json 文件中添加 {"sudo": true} 解决了这个问题。

刚刚在 .vscode>launch.json 中添加了以下行

{
"version": "0.2.0",
"configurations": [
{
"other..." : "configs...",
"request": "launch",
"console": "integratedTerminal",
"args": [
"${file}"
],
"sudo": true
}
]
}

我使用的 VS 代码版本是 -

Version: 1.49.1 OS: Ubuntu 16.04 LTS, 64-bit

这似乎不适用于所有语言。对我来说它适用于 python 3.x 其他用户报告它不适用于 C/C++。

关于c++ - 如何在VSCODE中调试带有 "sudo"的程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40033311/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com