Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install GCC and GDB for WSL(windows subsytem for linux)?

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.

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

like image 687
Aravind Emmadishetty Avatar asked Jun 05 '20 13:06

Aravind Emmadishetty


1 Answers

You need to:

  1. Update and upgrade:
$ sudo apt-get update && sudo apt-get upgrade -y

enter image description here

2.Clean unrequired packages:

$ sudo apt autoremove -y

enter image description here

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

enter image description here

  1. Check and confirmed installed gcc version:
gcc --version

enter image description here

like image 80
Hasan A Yousef Avatar answered Nov 06 '22 18:11

Hasan A Yousef