You need to:

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

2.Clean unrequired packages:

Copy$ sudo apt autoremove -y

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

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

Answer from Hasan A Yousef on Stack Overflow
🌐
Host IT Smart
hostitsmart.com › manage › knowledgebase › 435 › install-gcc-compiler-on-windows.html
How to Install GCC Compiler on Windows?
May 21, 2025 - If you prefer a Linux-like environment on Windows, the best way to install GCC is through Windows Subsystem for Linux (WSL).
Discussions

gcc - Installing g++ on windows subsystem for linux - Stack Overflow
A while back I activated Windows Subsystem for Linux on my machine but didn't use it much. Now I have an idea what I could use it for and that is why I'm trying to install gcc/++ 7 on my WSL and keep More on stackoverflow.com
🌐 stackoverflow.com
The GCC compiler
As far as GCC is concerned it runs on Linux. It does not matter whether that’s a native Linux or any kind of emulation, simulation, virtualization. A “faked” Linux may have limitations compared to a real one, but that’s a different topic and has nothing to do with GCC. There’s also an option to run GCC natively on Windows: as a part of MinGW. More on reddit.com
🌐 r/cpp_questions
37
35
February 26, 2021
HOW to ACCESS GCC installed on windows in wsl
I installed gcc, gdb, g++ through msys2 on windows and recently I installed wsl with openSUSE. please tell me how to access msys gcc on opensuse or do i have install a separate gcc on openSUSE wsl. Is it ok to do so or will cause any problem or will… More on learn.microsoft.com
🌐 learn.microsoft.com
1
0
January 5, 2024
GCC doesn't install ?

As somebody else suggested make sure you run apt-get update first.

More on reddit.com
🌐 r/bashonubuntuonwindows
5
3
August 28, 2020
🌐
YouTube
youtube.com › watch
GCC and GDB installation on WSL and learn howto get information about your system hardware - YouTube
This video shows you how to install gcc and gdb in WSL. You also learn howto show your hardware information of your system.This video is part of lecturer of ...
Published   May 24, 2022
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to install gcc on windows
How to Install GCC on Windows
April 22, 2026 - Run wsl --list --online to see a list of other available distros, and install one using the syntax below: ... 3. Restart the system when prompted and the installation continues automatically. Type in the username and password you want to use for your Linux distro: After the installation process completes, you can install GCC:
🌐
IBM
ibm.com › docs › en › drfz › 9.1.0
Installing Windows Subsystem for Linux - IBM Documentation
September 30, 2025 - To work with COBOL in Rule Designer, you must install Windows Subsystem for Linux (WSL) with GNU Compiler Collection (GCC) support.
🌐
Visual Studio Code
code.visualstudio.com › docs › cpp › config-wsl
Using C++ and WSL in VS Code
November 3, 2021 - In this tutorial, you will configure Visual Studio Code to use the GCC C++ compiler (g++) and GDB debugger on Ubuntu in the Windows Subsystem for Linux (WSL). GCC stands for GNU Compiler Collection; GDB is the GNU debugger.
Find elsewhere
🌐
Wordpress
christophep.wordpress.com › 2018 › 11 › 10 › installing-wsl-ubuntu-bash-gcc-g-on-windows-10
Installing WSL, Ubuntu Bash, GCC, G++ on Windows 10 | ChristopheP on Microsoft Technologies
November 10, 2018 - Go to aka.ms/wslstore and install Ubuntu. Run bash and create a user account with a password. Make a “sudo apt update” to update the repo packages. Then you can do “sudo apt install gcc” and “sudo apt install g++”.
🌐
Eleven Forum
elevenforum.com › windows support forums › virtualization and wsl
gcc-11 for Ubuntu 24.04.6 on WSL2 | Windows 11 Forum
June 30, 2023 - sudo apt update && sudo apt upgrade sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y sudo apt install -y gcc-11 gcc-11 --version · Click to expand... change the toolchain-r/ppa to toolchain-r/test This worked in a Native ubuntu install --should also work AFAIK on WSL.
🌐
GitHub
gist.github.com › Ayush-Kadali › 637c2dac5ca784bc77022329cd434b6c
Install VSCode and gcc using wsl on Windows 10/11 from ground up · GitHub
Type wsl --install in the terminal - Wait for Ubuntu to get installed - Enter your preffered username - Enter your pasword and retype the password · NOTE: WHEN YOU TYPE THE PASSWORD YOU WILL NOT SEE THE CURSOR MOVE SO BE SURE OF WHAT YOU WOULD ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 1479805 › how-to-access-gcc-installed-on-windows-in-wsl
HOW to ACCESS GCC installed on windows in wsl - Microsoft Q&A
January 5, 2024 - It's supported to run Windows executables from WSL and the Windows file systems are mounted under /mnt. Sorry I do not use msys2 but you can see if the gcc.exe can run normally from bash.
🌐
GitHub
gist.github.com › Roy-Fokker › 945c8f4684a3d1ca581cc9d809cdd9bb
Steps to configure WSL ubuntu (latest) with Latest GCC and Clang compilers · GitHub
Steps assume a clean WSL linux distro · sudo apt install build-essential git 7zip zip unzip pkg-config ... sudo update-alternatives \ --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 \ --slave /usr/bin/g++ g++ /usr/bin/g++-13 \ --slave /usr/bin/gcov ...
🌐
Up
www3.dcc.fc.up.pt › ~fds › aulas › pi › 2425 › praticas › aula01-configuracao_wsl.html
Brief Tutorial on Configuring WSL and Installing GCC on Windows
Run the following command to install WSL and set Ubuntu as the default distribution: ... After installation, restart your computer if necessary. Once restarted, open Ubuntu (available in the start menu) and follow the on-screen instructions to create a user and password. ... GCC (GNU Compiler ...
🌐
YouTube
youtube.com › watch
How to Install GCC Compiler on Windows 10 & 11, Linux & Ubuntu for C / C++/C# Language - YouTube
How to Install GCC Compiler on Windows 10 & 11, Linux & Ubuntu for C / C++/C# Language--This video will show you how to How to Install GCC on Windows 10 & 11...
Published   October 2, 2022
🌐
DEV Community
dev.to › tigawanna › linux-ccpp-in-wsl-ubuntu-setup-1fdc
linux c/cpp in wsl ubuntu setup - DEV Community
May 8, 2022 - if you haven't set up wsl enviroment check this out first · download gcc compiler and betty linter for c/c++ development Type the following one by one · sudo apt install build-essential · sudo apt update · sudo apt-get install manpages-dev ...
🌐
Solarian Programmer
solarianprogrammer.com › 2017 › 05 › 04 › building-gcc-wsl-windows-subsystem-linux
Building GCC 10 on Windows Subsystem for Linux | Solarian Programmer
May 4, 2017 - Let’s make sure that you have an up to date system, start WSL and write: ... 1 cd ~ 2 wget https://ftpmirror.gnu.org/gcc/gcc-10.1.0/gcc-10.1.0.tar.xz 3 tar xf gcc-10.1.0.tar.xz 4 cd gcc-10.1.0 5 contrib/download_prerequisites · At this point, we can configure the build. In order to keep the system clean, we will use /usr/local/gcc-10.1.0 for the installation folder and append the suffix -10.1 to the GCC compilers.
🌐
Reddit
reddit.com › r/learnprogramming › help install g++ on ubuntu wsl
r/learnprogramming on Reddit: Help install g++ on Ubuntu wsl
November 20, 2022 -

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?