Setup: Tech stack
As with any computer science course, CPSC 221 needs a few tools set up before you can start on labs and assignments. Below is the tech stack for this course — the tools and environment you’ll use to write, compile, and submit C++ code.
Hardware
Before starting, ensure that your laptop meets the minimum requirements:
- Can connect to networks via a wireless connection.
- Has at least 25 GB disk space available.
- Has at least 4 GB of RAM (more is recommended).
- Uses a 64-bit CPU.
- Is at most 6 years old at the start of the course (4 years old or newer is recommended).
- Student user has full administrative access to the computer.
If your computer does not meet any of the requirements above, please don’t just drop the course!! Let me know first and we can discuss alternate possibilities so you can still take the course.
Computing environment
All programming assignments and labs in this course use C++, compiled with clang. You submit your .h/.cpp files directly to PrairieLearn, which compiles and tests them for you — but you’ll want a working local (or remote) build to develop and debug against before you submit.
Connect to the department’s remote server
The department provides a shared Linux server for coursework: remote.students.cs.ubc.ca, accessible via SSH with your CWL ID and password (not a separate CS account).
Recommended: VS Code + Remote-SSH
- Download VS Code.
- Install the Remote - SSH extension (search “SSH - Remote” in the Extensions panel).
- Click the new remote-connection icon in the bottom-left corner, choose Add New SSH Host, and enter
your-CWL-id@remote.students.cs.ubc.ca. - If prompted for a platform, choose Linux (the remote servers run Linux, regardless of your own OS).
- Connect, enter your CWL password, then use the Files Explorer to open a folder — this becomes your working directory on the server.
To skip re-entering your password every time, generate an SSH key and copy it to the server:
ssh-keygen
ssh-copy-id your-CWL-id@remote.students.cs.ubc.ca # macOS/Linux(On Windows, use type path\to\id_rsa.pub | ssh your-CWL-id@remote.students.cs.ubc.ca "cat >> .ssh/authorized_keys" instead of ssh-copy-id.)
The command line
You’ll be working at a Linux shell on the remote server. If you’re new to it:
pwd # print working directory
ls # list files in the current folder
cd FOLDER # change into FOLDER; cd .. goes up, cd (no args) goes home
mkdir FOLDER # create a folder
rm FILE # delete FILE; rm -r FOLDER deletes a folder and its contents
mv SRC DEST # move/rename
cp SRC DEST # copy
make PROGRAM # build PROGRAM using the rules in a MakefileGetting lab/assignment files onto the server
Each lab/PA is distributed as a .zip from PrairieLearn. Get it onto the server with either:
- VS Code: drag and drop the unzipped folder into the Files Explorer once connected, or
- Command line (macOS/Linux):
scp your-file.zip your-CWL-id@remote.students.cs.ubc.ca:path/to/folder, thensshin andunzip your-file.zip.
Compiling and testing
Most labs/PAs include a Makefile. To build:
makeIf make fails, read the error message — clang is generally good about pointing at what’s wrong and suggesting a fix. If it succeeds, run the resulting executable directly (e.g. ./lab_intro) to test your work before submitting.
Submission is separate from compiling locally: you upload your source files to the PrairieLearn question, which compiles and grades them independently. A clean local build is a good sign, but the PrairieLearn autograder result is what counts.
C++ references
- cplusplus.com and cppreference.com — language/standard library references
- Unix and
make/Makefile tutorials — the lab starter code builds withmake, so a basic understanding of Makefiles will help - If you’re coming from Java: search for “C++ for Java programmers” guides to map concepts you already know onto C++ syntax
C++ short course (optional)
A past offering of this course recorded an optional video series introducing C++ specifically for this course’s needs (classes, pointers, arrays, parameter passing, the “Big 3,” operator overloading). See the C++ Short Course page for the recordings and slides.
More tips and optional readings
The older Computing Environment page has additional background on the department’s servers (it predates the current remote.students.cs.ubc.ca hostname, but the general concepts still apply).
Attribution
The computing-environment instructions above are adapted from the current PrairieLearn “Lab Intro” question’s setup walkthrough. The general tech-stack framing (hardware requirements, etc.) is adapted from the UBC-Vancouver MDS Install stack under a CC-BY-SA 4.0 license, originally written by Anmol Jawandha and updated by Stephan Koenig, Firas Moosvi, Joel Ostblom, Tomas Beuzen, Rodolfo Lourenzutti, Tiffany Timbers, and others.