How to install G++ the C++ compiler on Ubuntu 20.04 LTS Focal Fossa Linux -

G++, the GNU C++ Compiler is a compiler in Linux which was developed to compile C++ programs. The file extensions that can be compiled with G++ are .c and .cpp. The aim of this tutorial is to install G++ the C++ compiler on Ubuntu 20.04 LTS Focal Fossa Linux. This will be achieved by installing the build-essential package.
This is a companion discussion topic for the original entry at

i am facing this type of problem for installing gcc

sudo apt install build-essential
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:
build-essential : Depends: gcc (>= 4:9.2) but 4:7.4.0-1ubuntu2.3 is to be installed
Depends: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Hi Pk123456,

Welcome to our forums.

Your problem may be related to the recent release of this major version, which cause many changes in the repositories. Try to clean your apt cache:

$ sudo apt clean

And re-run the installation command. Let us know it that works for you.