Installing GCC C++ (cpp) compiler in Ubuntu
In Ubuntu we can use apt-get to install the build essential package available in the repository to get our GCC c/c++ compiler working. This will also help with being able to install programs from source.
Now open up a terminal. You can do this easily by holding down [ALT] and pressing [F2] which brings up the "Run Application" window. Then type gnome-terminal and press [Enter]. Now at the terminal we will first update, upgrade and then install the build=essential package.
# update apt-get resources $ sudo apt-get update # update the system $ sudo apt-get upgrade # install build-essentials $ sudo apt-get install build-essential # check the versions to see if everything is correct $ gcc -v $ make -v
Now you can compile c/c++ programs easily on the command line. If you had a c file called calendar.c you can now compile it using the following command.
# compile calendar.c $ gcc calendar.c -o calendar # run compiled calendar program $ ./calendar