如何为WSL(Linux的Windows子系统)安装GCC和GDB? [英] How to install GCC and GDB for WSL(windows subsytem for linux)?

查看:88
本文介绍了如何为WSL(Linux的Windows子系统)安装GCC和GDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need gcc to compile a c code and unable to install gcc on wsl. I tried sudo apt-get install gcc but it doesn't work. This is the error.

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.谢谢.

I don't know the dependencies to install. Please help me with gdb also. thankyou.

推荐答案

您需要:

  1. 更新和升级:

$ sudo apt-get update && sudo apt-get upgrade -y

2.清理不需要的软件包:

2.Clean unrequired packages:

$ sudo apt autoremove -y

  1. 安装GCC:

$ sudo apt-get install gcc -y

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

gcc --version

这篇关于如何为WSL(Linux的Windows子系统)安装GCC和GDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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