CUEH

Development Environment Guides

Installing C++

Installing C++

As part of the programming module you study on the course, you will be tasked with using the C++ programming language to complete lab activities.

In this guide, you shall be taken through the journey of installing C++ for the Linux (Debian-based) operating system.

Downloading and Installing C++

By default, the Linux environment will not have the C++ compiler installed. Installing C++ is relatively straight forward in Linux, and requires installing a package using the command-line interface (CLI). To install the C++ compiler, you will need to install the build-essential package which can be achieved with the following command:

$ sudo apt install build-essential

When this command is entered in the CLI, you will be met with a question similar to the one shown in the screenshot in Figure 1.

Figure 1

Figure 1. Installing `build-essential` on a Linux system.

This will ask whether you would like to install the packages that are listed in the CLI window. These are packages that are a part of the build-essential package and are useful when developing applications on a Linux system. You may want to review these packages, and if they are suitable you can install them by enter Y and pressing the Enter key. This will begin the installation process of the relevant packages.

The packages listed in Figure 1 may be different to the list of packages that are present on your machine/system. These are the packages that are required: g++, g++-multilib and make.

Checking the C++ Installation

To confirm that everything is working as expected, you will need to perform a quick check using the command-line interface. To perform this check, open Terminal by pressing the key combination, Ctrl + Alt + T. This will open the CLI. With the command-line interface open, you can type the command g++ -v and the C++ compiler should be executed and return the current version number, shown in Figure 2.

Figure 2

Figure 2. The C++ Compiler in the Terminal Window.

Conclusion

That is the end of this guide on installing C++ and if you have followed all the necessary steps correctly, you should have a fully functional implementation of the C++ compiler which will enable you to complete any necessary C++ programming-based activities and assignments you will participate with on this course.

Mistakes or Problems?

If you have spotted any errors or issues within this tutorial, you can e-mail Dr Ian Cornelius. Ensure to include in your message a description of the error/issue and a possible resolution. Also do not forget to include a URL to the page with the issue/error.