Department of Engineering

IT Services

Installing C++ compilers

To develop C++ programs on your own machine you need to ensure that you have a text editor and a C++ compiler. First years will also need the GLUT graphics libraries too, in order to do the vacation exercise.

Here are some options that have worked for us in the past. Included are instructions on using some libraries too. Note: if you're installing so that you can do the Mars Lander exercise, see the Mars Lander page in Moodle from which the information here has been adapted.

Windows

To work on the Mars Lander exercise, you need to ensure that you have three key components installed on your PC: a text editor, a C++ compiler and Octave/Matlab.

  • First, install Microsoft's Visual Studio Community 2015 from here. You will need to create an account with Microsoft if you do not already have one. You need to do a Custom installation, not a Typical installation. From the list of custom features you are offered, open the Programming Languages list, then the Visual C++ list, then select Common Tools for Visual C++ 2015.
  • Installing Visual Studio after signing in to your Microsoft account should result in a permanently licensed installation on your PC. You can check this by launching Visual Studio, clicking on the Help menu, then About Microsoft Visual Studio, then License Status.

MacOS

For the C++ compiler, you will need to install Xcode from the App Store (or from your installation CD if you have an older version of Mac OS X). There are two ways you can proceed to use the compiler: by typing instructions into a terminal, or from within the Xcode integrated development environment

Linux

If you have a PC running Linux, the chances are you know how to install software packages, so these notes will be brief. Suffice to say that you will need a C++ compiler (g++), make, a text editor, Octave and the OpenGL/GLUT graphics libraries. Some of these might be installed on your computer already, if not you will find suitable packages for all recent Linux distributions in the standard repositories. For example, Ubuntu users should install:

  • g++
  • make
  • emacs (if you prefer this editor to the default gedit)
  • octave
  • freeglut3-dev

To compile the supplied C++ source code, open a text terminal, navigate to the directory where you unzipped the files (type ls to list files and directories, use cd [directory name] to change directory), and then type make. To run the compiled executable, type ./lander.

If you are a new Linux user and find these notes too brief, please post a query on the Moodle forum, we will be happy to help.