The University of Western Australia
CITS2002 Systems Programming
 

Department of Computer Science and Software Engineering

CITS2002 Systems Programming

Software for labsheets and projects

This unit requires students to complete laboratory exercises and projects in the C99 programming language. On whatever operating system platform you undertake these, you'll need to become familiar with two important items of software:

  • A text editor to create and modify your C programs (in text files). Note that you will not be able to use Microsoft Word to easily edit your C source code files. There are many different text editors available, but there is considerable advantage in knowing an editor available on multiple operating systems.
  • A C compiler to translate high-level C programming language instructions (human readable C source code) into machine-executable instructions. Under both the macOS and Linux operating systems the C compiler is named cc, and may be invoked from the command-line (the shell) by just typing cc at the prompt.

     

vim is a highly configurable text editor for efficiently creating and changing any kind of text. It is included as vi with most UNIX-based systems, including Apple's macOS and Linux, and can also be installed under Windows. If your system doesn't already have vi or vim, you may download it for free from vim.org.

Here's a good vi tutorial to read once you have vi installed.

If you'd like vim to add colours to your C code, highlighting the syntactic elements, then cut-and-paste and execute this command:

prompt> curl -o ~/.vimrc http://teaching.csse.uwa.edu.au/units/CITS2002/labsheets/vimrc

The file ~/.vimrc is read each time you run vim, so you can add a wide variety of commands to tailor vim.

A brand new macOS installation comes with vi but does not come with a C compiler, as Apple don't expect all users to use their machines for program development.

You'll need to install Apple's Xcode (currently v10.3) from the Apple (Mac) AppStore. It's free, but also 6.1GB in size (so download it while at UWA!). There is no need to download additional development components for iPhones, Apple TV, or Apple Watch.

Once downloaded, just click on its package icon and follow the prompts to install it as you would any other Apple application. You can check if your installation is complete by simply typing just cc at the command-line prompt, hoping to receive the response cc: no input files

While Linux is a single operating system, it is distributed by a number of different companies and developers using different Linux Distributions. All distributions will include the vi text editor, but not all distributions include the C compiler. gcc is installed, by default, in the popular Ubuntu Desktop, but not in the popular Fedora distribution (from v29 onwards).

The instructions for installing the C compiler, gcc, are very similar for all popular distributions. Follow this tutorial - How to Install GCC Compiler on Ubuntu 18.04

You can check if your installation is complete by simply typing just cc at the command-line prompt, hoping to receive the response cc: no input files

While Windows has a very powerful integrated development environment (IDE) named Visual Studio, it does not support C99. You can avoid this problem, and get far better support for C99 and the content of this unit, by following the guide Stepwise Guide to Enable Windows 10 Subsystem for Linux.

Ensure that your Windows computer is running Microsoft Windows-10, and not the much older Windows-7, for which technical support will be dropped at the end of 2019 (its End-Of-Life). Windows-10 is free for university students.

When choosing a Linux distribution from the Windows Store, it's recommended that you install Ubuntu 18.04 LTS.

With Windows Subsystem for Linux installed, you will already have the vi text editor installed. To further install the C compiler gcc, you'll need to execute:

prompt> sudo apt update (need to type your password) prompt> sudo apt install gcc (to install gcc, its headers, and libraries)

and you then should be able to edit and compile your first C program.

Helpful - Frequently Asked Questions about Windows Subsystem for Linux.

A Raspberry Pi runs a modified Linux operating system and its base installation comes with both vi and gcc. While the version of gcc may be a little older (likely v8.3) it should support our laboratory exercises and projects. You might consider using a Raspberry Pi, connected to your existing laptop, as an easy way to aggressively experiment with Linux, without destroying your laptop.

It is possible to update the compiler on a Raspberry Pi to the later v9.0, but you will need to rebuild the compiler (to compile the compiler!), rather than just install it. Rebuilding gcc on a Raspberry Pi takes about 4.5 hours, and to rebuild the Raspberry Pi Linux kernel takes about 17 hours!

Department of Computer Science and Software Engineering

This Page

Written by: Chris.McDonald@uwa.edu.au