C++ development environment setup
1. Create an account on GitHub.com
We distribute all machine problem (MP) starter codes through the GitHub classroom. To accept the assignments, you will need a GitHub account. If you haven't an account with GitHub or would like to create a new handle for this course,
- Navigate your browser to github.com,
- click the Sign Up link, and
- create an account!
2. Install git on your system
We will use git
to interact with your assignment repositories on
github.com and, more broadly,
for source code version control in this course. Accordingly, the next
step is to download and install git
on your system:
- On macOS, we accomplish this by installing Xcode Command Line Tools through the following steps:
- Open the Terminal application, and
- execute the following command:
xcode-select --install
git
download for Windows (https://git-scm.com/download/win)git
download for Linux (https://git-scm.com/download/linux)
3. Install and configure VS Code
Install VS Code
We will use Microsoft Visual Studio Code (aka VS Code) as our integrated development environment (IDE) this semester. VS Code is a powerful, free code editor that runs in the macOS, Windows, and Linux operating systems. To install VS Code, please follow the directions for your machine:
- Directions to install VS Code on macOS
(https://code.visualstudio.com/docs/setup/mac)
- Do not install using the Download link in the directions above. Instead, select the version for your machine (Intel or Mac Silicon) via code.visualstudio.com/download. Then continue with the directions in the link above.
- Directions to install VS Code on Windows (https://code.visualstudio.com/docs/setup/windows)
- Directions to install VS Code on Linux (https://code.visualstudio.com/docs/setup/linux)
Open VS Code
The next steps will be completed within the VS Code application.
Install the required VS Code extensions
There are various extensions that we need you to install in VS Code. Please install the following extensions by navigating to their respective page(s) in the VS Code Marketplace, and clicking the green "Install" button located near the top of the page.
Trouble installing an extension? Click here!
Disable Restore Windows in VS Code
- Open Settings
- Mac / Linux:
⌘
+,
- Windows:
Ctrl
+,
- Mac / Linux:
- In the search box type
restore windows
. - Set
Restore Windows
toNone
(via the drop-down list).
Connect VS Code to GitHub
To access the private repositories containing the starter code distributed in this course, you must log in to GitHub from within VS Code. Please follow along with the video below to connect your VS Code with your GitHub account. The link used in the video to acquire your private repository of the code is available through classroom.github.com/a/_TjBl-4m.
4. Install Docker Desktop
We will use Docker Desktop this semester to run the CS 128 containerized development environment. To install Docker Desktop, please follow the directions for your machine:
- Directions to install Docker Desktop on macOS (https://docs.docker.com/desktop/install/mac-install/)
- Directions to install Docker Desktop on Windows (https://docs.docker.com/desktop/install/windows-install/)
- Directions to install Docker Desktop on Linux (https://docs.docker.com/desktop/install/linux-install/)
Should you require assistance installing Docker Desktop, please visit us during office hours during the first week of class so we can help get you up and running before our first machine problem (MP) is released.
5. Login to Docker Hub via Docker Desktop
To pull our the image for our development environment, you will need to:
- First, register for a Docker Hub account at hub.docker.com/signup, and
- Open the Docker Desktop application, authenticate using the Sign in option in the top-right corner of the Docker Dashboard.
6. Connecting to, and working inside of, the development environment
Now that we've set things up, it's time to introduce how to connect to the CS 128 development environment and author your solutions to programming problems. Please carefully watch the video that follows. You can access the assignment (you previously accepted) to complete the setup at classroom.github.com/a/_TjBl-4m as directed in the video.
What if I don't see the open in dev container popup?
If the popup asking whether you want to open the folder in the dev container does not show up, you should:
- Open the "Command Palette" (Ctrl Shift P for Windows/Linux or Command Shift P for Mac),
- type "Dev Containers: Reopen in Container", and
- select to execute that command (click it!).
7. Using the environment with your own projects
To use the development environment you just configured with your own personal projects, you'll need to start with the CS 128 environment dotfiles available at github.com/cs128-illinois/env-dotfiles.
This repository serves as your essential starting point for any new project where you want to use the CS 128 development container. It contains all the necessary configurations to properly integrate the development environment you just set up with your personal projects.
Important: You will need one copy of these dotfiles for every project you'd like to use the development environment with. Each project should have its own copy of the configuration files.
The dotfiles repository includes:
- Development container configuration files
- VS Code settings and extensions optimized for C++ development
- Build configurations and debugging setup
- All necessary files to connect your project to the CS 128 development environment
To set up a new personal project with the development environment:
- Clone or download the dotfiles repository and rename for your project:
git clone https://github.com/cs128-illinois/env-dotfiles.git .
- Open the project in VS Code and reopen in the development container
For debugging support: To use the visual debugger with your personal projects, ensure your
compiled executable is named exec
and placed inside a directory called bin
at your
project's root (i.e., bin/exec
). This naming convention is required for the debugger configuration
to work properly.