如何为 WSL(windows 子系统 linux)安装 GCC 和 GDB?
How to install GCC and GDB for WSL(windows subsytem for linux)?
我需要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 update && sudo apt-get upgrade -y
2.Clean 不需要的包:
$ sudo apt autoremove -y
- 安装 GCC:
$ sudo apt-get install gcc -y
- 检查并确认安装的 gcc 版本:
gcc --version
我需要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 update && sudo apt-get upgrade -y
2.Clean 不需要的包:
$ sudo apt autoremove -y
- 安装 GCC:
$ sudo apt-get install gcc -y
- 检查并确认安装的 gcc 版本:
gcc --version