我需要 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。谢谢你。
我也尝试为我的 WSL 安装 gcc。
我首先尝试了“
sudo apt-get install gcc
”(来到这里之后)。gcc --version
”后,终端吐出:
未找到命令“gcc”,但可以使用以下命令安装:
sudo apt install gcc
然后我只是尝试了“
sudo apt install gcc
”,就像终端所建议的那样。gcc --version
”后,终端吐出:
gcc(Ubuntu 13.2.0-23ubuntu4)13.2.0
版权所有 (C) 2023 自由软件基金会,Inc.
这是免费软件;请参阅复制条件的来源。 没有 保修单;甚至不是为了适销性或特定用途的适用性。
表明它有效。