How to install gcc 13 on Ubuntu

G++ 13

G++ version 13 introduce significant advancements over version 12, including enhanced support for C++23 features like deducing this and if consteval statements, improved optimization capabilities with better vectorization and inter-procedural optimizations, upgraded diagnostics for clearer error messages, and expanded library support with performance enhancements in libstdc++. These updates improve code efficiency, developer productivity, and compatibility across various platforms, making G++ 13 a compelling choice for modern C++ development.

Add the Toolchain PPA

The first step is to add the necessary PPA to your system:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update

Install G++ 13

Next is to install G++ 13:

sudo apt install gcc-13 g++-13

Set GCC 13 as the default compiler

You may want to set GCC 13 as the default compiler. You can do this by updating the update-alternatives system.

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100

Then, you can select G++ 13 as the default:

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

Verify the installation

To confirm that GCC 13 and G++ 13 are installed and set as the default, you can check the GCC version.

gcc --version
g++ --version

This should show you GCC 13 as the current version.

c++
gcc
apt
ubuntu
Software and digital electronics / IT
Posted by admin
2024-07-09 11:15
×

Login

No account?
Terms of use
Forgot password?