In this course, we will use some additional software that will need to be installed on your personal device.

  • VS Code, an IDE for coding and debugging later in the course.
  • Git, for downloading, and submitting, exercises and assessment items.
  • Various other packages as required.

Installation#

Virtual Machine#

The following steps can be followed on any machine, but provide a worse experience than developing natively on your computer. Try the machine specific instructions first, and follow these as a backup if you encounter issues.

  1. Install Virtual box
  2. Download the Ubuntu 20.04.4 ISO image (Desktop image)
  3. Make a new Virtual Image
    • Any machine name is fine.
    • Pick ‘Linux’ and ‘Ubuntu’ as the machine type.
    • It is recommend to use at least 2048 MB of RAM and 20 GB hard drive size.
  4. When prompted, select the ISO file you downloaded
  5. When Ubuntu loads click ‘Install Ubuntu’
  6. Continue with default options until it installs (it will only erase the virtual image data, not your host operating system data).
    • You can safely select the ‘minimal installation’
  7. Configure the settings
    • Any location is fine
    • Use student as the name. Leave the autofilled entries after inserting this name.
    • Pick a password and don’t forget it.
    • Other defaults are fine.
  8. Accept and wait for configuration to finish
  9. Accept the restart and press Enter when prompted
  10. In Ubuntu, open the ‘Terminal’ application
  11. In Terminal run
    sudo apt update && sudo apt install -y gcc git make
    

    Enter your password when prompted. It will not display the text as you type.

  12. In Terminal run
    sudo snap install --classic code
    

    Enter your password when prompted.

  13. You may want to adjust the screen resolution. Open Settings > Screen Display and set the Resolution as you like.
  14. Set up VS Code

From here you can follow the Git steps in labs 1 and 2. Note you will need to redo the ‘first time only’ parts, as this is effectively a new computer.

Verify the setup works by following the lab 8 instructions.

Lab Machine#

Lab machines already have the main environment set up, all you need to do is set up VS Code.

Windows 64-bit#

This course involves writing applications that interact with the operating system using “system calls”. Unfortunately, Windows’ system call interface is very different from Unix-type systems (i.e. Linux and Mac). However, the Windows Subsystem for Linux (WSL) is a lightweight compatibility layer that allows you to use Linux system calls and operations on a Windows machine. Programming through WSL is the officially recommended method for Windows users in this course.

  1. Download & install Git. Git Bash will behave like a terminal on the lab machines and should let you do all the usual Git commands.
  2. Download VS Code from here. If you need a version other than the 64 bit windows installer, you can find it on their alternate downloads page.
  3. Set up VS Code
  4. Open a terminal from the terminal menu at the top of VS Code. A terminal window will open at the bottom of your screen. In this terminal window, there will be a drop-down menu at the top-right. Choose “Select Default Profile”, and choose “Git Bash”. terminal default
  5. Install WSL.
  6. Set up WSL
    1. Open WSL in a terminal by simply typing wsl.
    2. You will first be prompted to create a default Unix user account. When typing in your password, nothing will show up on screen, but your password IS being typed in! This is normal Unix behavior that will appear elsewhere too (e.g. putting in Git passwords).
    3. In WSL, run sudo apt-get update && sudo apt-get upgrade -y. APT (Advanced Package Tool) is the default package manager on Linux; this will update its package information.
    4. Run sudo apt-get install -y make gcc gdb to install Make, GCC and GDB, the key tools for C programming you will need throughout the semester.
    5. Set up Git in WSL by running git config --global user.name "<Your UID>" and git config --global user.email "<Your UID>@anu.edu.au"
  7. Set up VSCode to allow using WSL inside it (Optional; this allows using the VSCode debugger. You can also use the terminal commands for GDB if you’d like.)
    1. Make sure you are using Visual Studio Code, as a few extensions we use are not available on VSCodium (the open-source version) on Windows. Unfortunately, no workaround has been found as of yet, so VSCodium on Windows is not supported.
    2. Install the WSL extension by Microsoft
    3. You will now see a “Remote Explorer” tab on the left side. Upon clicking, you’ll see a pane that says “WSL Targets”. Click on the “Connect in New Window” button next to where it says “Ubuntu”. See below for more.
    4. Navigate to your local files. WSL uses a seperate filesystem from your Windows OS, but the normal Windows filesystem can still be accessed in WSL through the directory /mnt/c (where it is “mounted”). This directory’s contents are exactly the same as the “C:” drive on your system. Using terminal commands (see Lab 1; ls and cd are sufficient), navigate through to where you have your COMP2310 work.
      • In the future, VSCode will remember “recent” folders you accessed in WSL and you won’t have to do this annoying navigation step again.
    5. Go to the Extensions tab and install the C/C++ extension inside the remote WSL: Ubuntu. This will allow you to access the extension inside WSL.
    6. Done!

Remote explorer icons and panel

macOS#

  1. Install XCode from the App store.

  2. Download & install VS Code. You may need to hold the control key and click to install in order to bypass a software security check.

  3. Set up VS Code

If things go wrong, check the Troubleshooting section further down this page.

Linux (Not a Lab Machine)#

These instructions are aimed at Ubuntu, but should work for any sensible Linux distro that’s up to date. If you’re using something other than Ubuntu, I trust that you know what you’re doing. If you need help, you can try asking on course forum, but we may not be able to assist with all flavours of Linux. For Arch users: VS Code has an AUR package, so you don’t need to download a tarball.

  1. Download & install VS Code. You’ll want to download the .deb file. Install the package once downloaded. Using another IDE is difficult — our assembler is a VS Code extension. VS Codium is an option as well, as used on the lab machines.

  2. Set up VS Code

  3. Ensure that you have gdb installed with sudo apt-get install gdb

The rest of this page is information to help you if you get stuck with software issues. If you’ve just finished your initial software install, head back to lab 1 now.

VS Code#

Setup#

  1. Have VS Code installed by following the relevant platform specific instructions

  2. Install the C/C++ Extension Pack Extension Pack Image

Using#

VS Code has good documentation. The lab material will link to specific parts of it where appropriate. Many settings can be changed to customize the appearance and behaviour of VS Code — feel free to set things up to your liking. In particular you may want to enable autosave.

Troubleshooting#

Here’s a list of issues you might come across, depending on the specific details of your machine. As always, be careful with copy-pasting random code you found on the internet (even in a university course!), and try to understand the problem first before you try the solutions listed.

If new problems come up on Piazza, they will be added to this page once a solution is found.

VS Code Developer Tools Console#

Before you look at the specific problems, here’s a tip for getting the most useful error messages out of VS Code when things are going wrong. In command pallete, run the Developer: Toggle Developer Tools command and you’ll see a new pane pop up in VS Code. Switch to the Console tab (top-right of the screenshot) and you’ll see something like this:

VS Code developer tools pane

Keep this view open while you do the command which isn’t working for you, and it might output some error messages here (watch for red lines of text) which give you more detailed information about what’s going wrong. If the issue is not immediately obvious, now would be a good time to consult with a tutor or post on Piazza.

OS Specific Problems#

[Windows] Integrated Terminal Freezes#

On some Windows machine VS Code terminal tab freezes at start up. This happens irrespective of the shell selected. Because of this the debugger will not run.

The cause of the problem is still unclear. There is no fix at the moment.

[Windows] Git HTTP Basic Authentication Failed#

Open the start menu, and search for Credential Manager. Select Windows Credentials, then search for git in the list of generic credentials. Either update your password or delete the entry to resolve the issue.

bars search times arrow-up