使用 Visual Studio 代码和 Vagrant runnig ubuntu 调试 C 应用程序 [英] Debug C app using visual studio code and Vagrant runnig ubuntu

查看:105
本文介绍了使用 Visual Studio 代码和 Vagrant runnig ubuntu 调试 C 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Vagrant 启动 ubuntu 来编译一些 C 代码,现在我喜欢使用Visual Studio 代码.
我如何设置某种远程调试,其中编译器和源代码以及所有在 Ubuntu VM 上
我只在 Windows 中使用 VSCode?
PS.
这曾经在 windows WSL linux 上工作得很好.
但是现在我喜欢使用 Vagrant(使用 Virtual Box)在 Ubuntu 上获得相同的结果.可以做到吗?更新我按照建议进行了尝试,但出现错误:

I boot up ubuntu using Vagrant to compile some C code, now i like to debug this code using Visual Studio Code.
How can i setup some kind of remote debug where the compiler and source code and all on the Ubuntu VM
And I only using VSCode from windows?
PS.
This used to work very well with windows WSL linux .
But now i like to achieve the same result with Ubuntu using Vagrant ( using Virtual Box ). Can it be done? UPDATE I tried as suggested but I'm getting error :

我来自 vscode 的虚拟盒子配置:

my virtual box config from vscode :

Host 127.0.0.1:2222
  HostName 127.0.0.1:2222
  IdentityFile c:/HashiCorp/ubuntu-20.04/.vagrant/machines/default/virtualbox/private_key
  User vagrant

错误:

[13:27:45.945] "install" terminal command done
[13:27:45.945] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[13:27:45.945] Received install output: The process tried to write to a nonexistent pipe.
[13:27:45.950] Resolver error: Error: The process tried to write to a nonexistent pipe
    at Function.Offline (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:64330)
    at c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:59961
    at Object.t.handleInstallOutput (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:60339)
    at I (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:311112)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:309029
    at async Object.t.withShowDetailsEvent (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:403706)
    at async Object.t.resolve (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:312426)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:127:110280
[13:27:45.954] ------

推荐答案

是的,只要您在 VM 中配置了 SSH,就可以使用 Remote - SSH 扩展,正如我在 这个答案.

Yes, as long as you have SSH configured in the VM, you can use the Remote - SSH extension as I detailed in this answer.

这篇关于使用 Visual Studio 代码和 Vagrant runnig ubuntu 调试 C 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆