【问题标题】:How to install GCC and GDB for WSL(windows subsytem for linux)?如何为 WSL(Linux 的 windows 子系统)安装 GCC 和 GDB?
【发布时间】:2020-09-24 16:43:39
【问题描述】:

我需要 gcc 来编译 c 代码并且无法在 wsl 上安装 gcc。我试过sudo apt-get install gcc,但它不起作用。这是错误。

hack@DESKTOP-VMQA3JB:~$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gcc : Depends: gcc-9 (>= 9.2.1-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我不知道要安装的依赖项。也请帮助我使用 gdb。谢谢。

【问题讨论】:

  • 运行sudo apt-get updatesudo apt-get upgrade后还有问题吗?
  • 是的,它在更新和升级后工作......谢谢!

标签: windows gcc gdb windows-subsystem-for-linux


【解决方案1】:

你需要:

  1. 更新升级:
$ sudo apt-get update && sudo apt-get upgrade -y

2.清理不需要的包:

$ sudo apt autoremove -y

  1. 安装 GCC:
$ sudo apt-get install gcc -y

  1. 检查并确认已安装的 gcc 版本:
gcc --version

【讨论】:

  • 您好,只是想知道“sudo apt-get upgrade -y”中的“-y”是什么意思?
  • @Parting 表示回答y(是)fir 任何问题都需要确认才能继续。
猜你喜欢
  • 1970-01-01
  • 2019-07-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-23
  • 1970-01-01
  • 2021-05-05
相关资源
最近更新 更多