Do the following steps:
- 
Open your terminal (or) command-line window.
 - 
Type the following command and then press ENTER
sudo apt-get update - 
It will ask for the password. Type your
sudouser password and press ENTER - 
Then type the following command and then press ENTER again.
sudo apt-get install g++ 
This will install the g++ compiler in Ubuntu
6
solved How can install cpp compiler on Ubuntu terminal [closed]