gpt4 book ai didi

windows - 如何为 WSL(Linux 的 Windows 子系统)安装 GCC 和 GDB?

转载 作者:行者123 更新时间:2023-12-03 23:27:08 31 4
gpt4 key购买 nike

我需要 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
    enter image description here
    2.清理不需要的包:
    $ sudo apt autoremove -y
    enter image description here
  • 安装 GCC:

  • $ sudo apt-get install gcc -y
    enter image description here
  • 检查并确认安装的 gcc 版本:

  • gcc --version
    enter image description here

    关于windows - 如何为 WSL(Linux 的 Windows 子系统)安装 GCC 和 GDB?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62215963/

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