You need to:
- Update and upgrade:
Copy$ sudo apt-get update && sudo apt-get upgrade -y

2.Clean unrequired packages:
Copy$ sudo apt autoremove -y

- Install GCC:
Copy$ sudo apt-get install gcc -y

- Check and confirmed installed gcc version:
Copygcc --version

You need to:
- Update and upgrade:
Copy$ sudo apt-get update && sudo apt-get upgrade -y

2.Clean unrequired packages:
Copy$ sudo apt autoremove -y

- Install GCC:
Copy$ sudo apt-get install gcc -y

- Check and confirmed installed gcc version:
Copygcc --version

I too was trying to install gcc for my WSL.
I first tried the "sudo apt-get install gcc" to begin with (after coming here).
But then after entering "gcc --version", the terminal spat out:
Command 'gcc' not found, but can be installed with:
sudo apt install gcc
I then just tried just "sudo apt install gcc" like the terminal had suggested.
Then after again entering "gcc --version", the terminal spat out:
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Suggesting that it worked.
gcc - Installing g++ on windows subsystem for linux - Stack Overflow
The GCC compiler
HOW to ACCESS GCC installed on windows in wsl
GCC doesn't install ?
As somebody else suggested make sure you run apt-get update first.
More on reddit.comVideos
Why compiling? You should be able to install the package:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y
Verify using:
gcc-7 --version
See How to install gcc-7 or clang 4.0?
run the following
sudo apt install aptitude
sudo aptitude install gcc-7 g++-7
or
sudo apt install aptitude && sudo aptitude install golang gcc-7 g++-7
I want to know, is there a difference between the GCC compiler on Linux and on Windows. At my faculty they tell us to use a Linux virtual machine to run our programs. I find this slow. I, instead, use WSL2. Is there a difference between using that and a Linux VM, and is there a difference between just using Windows and using Linux.
I've only begun using Bash on Ubuntu and recently attempted to install gcc. When I try to run gcc I get informed I must install gcc. Although I did notice during the installation there were some errors ?
I have attached the full error message below as well as the main error message separately.
sudo apt install g++
[sudo] password for bzard:
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: cpp cpp-11 fontconfig-config fonts-dejavu-core g++-11 gcc gcc-11 gcc-11-base libasan6 libatomic1 libc-dev-bin libc-devtools libc6-dev libcc1-0 libcrypt-dev libdeflate0 libfontconfig1 libfreetype6 libgcc-11-dev libgd3 libgomp1 libisl23 libitm1 libjbig0 libjpeg-turbo8 libjpeg8 liblsan0 libmpc3 libnsl-dev libquadmath0 libstdc++-11-dev libtiff5 libtirpc-dev libtsan0 libubsan1 libwebp7 libxpm4 linux-libc-dev manpages-dev rpcsvc-proto Suggested packages: cpp-doc gcc-11-locales g++-multilib g++-11-multilib gcc-11-doc gcc-multilib make autoconf automake libtool flex bison gdb gcc-doc gcc-11-multilib glibc-doc libgd-tools libstdc++-11-doc The following NEW packages will be installed: cpp cpp-11 fontconfig-config fonts-dejavu-core g++ g++-11 gcc gcc-11 gcc-11-base libasan6 libatomic1 libc-dev-bin libc-devtools libc6-dev libcc1-0 libcrypt-dev libdeflate0 libfontconfig1 libfreetype6 libgcc-11-dev libgd3 libgomp1 libisl23 libitm1 libjbig0 libjpeg-turbo8 libjpeg8 liblsan0 libmpc3 libnsl-dev libquadmath0 libstdc++-11-dev libtiff5 libtirpc-dev libtsan0 libubsan1 libwebp7 libxpm4 linux-libc-dev manpages-dev rpcsvc-proto 0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded. Need to get 183 kB/62.5 MB of archives. After this operation, 201 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Ign:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libtiff5 amd64 4.3.0-6ubuntu0.1 Err:1 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 libtiff5 amd64 4.3.0-6ubuntu0.1 404 Not Found [IP: 91.189.91.39 80] E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff5_4.3.0-6ubuntu0.1_amd64.deb 404 Not Found [IP: 91.189.91.39 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Error message only:
Ign:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libtiff5 amd64 4.3.0-6ubuntu0.1 Err:1 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 libtiff5 amd64 4.3.0-6ubuntu0.1 404 Not Found [IP: 91.189.91.39 80] E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff5_4.3.0-6ubuntu0.1_amd64.deb 404 Not Found [IP: 91.189.91.39 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?