Setting Up Your Own C++ Development Environment
In this part of the assignment, you'll set up your own computer to be able to compile and run C++ code! There are two critical pieces of software we'll need:
- A C++ compiler (which you read about in this week's lessons)
- Git (which we need since we'll be fetching HW1 starter code from GitHub).
Once you've installed the necessary software, you'll test it out by trying to compile the HW1 starter code.
Why Are We Doing This?
CS 70 already has everything you need to compile and run C++ code on the course server. So why are we asking you to get things working on your own computer? The answer is simple: empowerment.
We believe you have the right to write and run code on your own computer. When you can write and compile C++ code on your own machine, you'll be able to write highly efficient code to solve problems on your own computer whenever you need to.
Not only that, but the skills for setting up a C++ development environment are transferable to other programming languages and in other contexts. In one sense, you're opening the door to the world of open-source software, which includes support for a variety of programming languages, but also a plethora of other tools and applications.
Your own computer, running software you wrote yourself in a language you picked because it was the right choice for the problem at hand, is a powerful thing. It could even be seen as a rite of passage for a computer scientist. We want you to have that experience.
Installing Our Toolchain
The exact process of installing the necessary software varies depending on your operating system. Therefore, to proceed, please select your operating system below:
Both partners should set up their own computers!
Setting Up Git and GitHub
The commands in the OS-specific pages linked to above installed both Git (the version control system) and GitHub CLI (a command-line interface for GitHub), but there are a few things you need to set up to be able to do work.
Git Configuration
To set up Git, run the following commands in the terminal:
git config --global user.name "your-name "
git config --global user.email "your-email@example.com "
Your own name and email should already appear in those commands. If you instead see your-name and your-email@example.com, just delete that and type your own name and email address into the quotes.
GitHub Setup
Next you need to set things up so you can authenticate with GitHub. The easiest way to do this is to use the GitHub CLI, gh, which you installed along with everything else on your platform's page. Run the following command in the terminal and follow the prompts:
gh auth login
With that done, you should be all set to use Git and GitHub on your own computer!
Cloning the HW1 Starter Code
You cloned your Homework 0 repository on the CS 70 server with git clone; getting the HW1 code requires you to use the same basic command on your own machine.
Once again, both partners should follow these steps on their own computers!
1. Open a Terminal on Your Own Computer
Open a terminal on your own machine, not on the CS 70 server. Everything you do in this part happens locally; if you find yourself typing something at a ~ SERVER > prompt, you are in the wrong place.
- macOS — Command-Space, type
Terminal, press Return. - Linux — Your desktop's terminal application.
- Windows — the MSYS2 terminal you installed above. Using the MSYS2 terminal instead of the Windows Terminal application matters: only the MSYS2 terminal can reach the Clang you just installed.
2. Choose Where on Your Computer You Want the Code to Be Stored
A new terminal starts inside your home folder—the “default” folder that also contains folders such as Documents, Downloads, and Music. You can always refer to your home folder as ~, and your platform's setup page above told you exactly where your home directory lives.
On Windows, the MSYS2 terminal has a home folder of its own that's different than the directory Windows considers to be your user directory.
Your home folder (~) is /home/, which lives inside MSYS2—it is not your Windows C:\Users folder. Your regular Windows drives are still reachable from inside MSYS2: your C: drive is at /c/, so (for example) your Windows desktop is /c/Users/.
Shift-Click to close.
Commands you run in a terminal happen start in whatever folder you are in when you run the command. So if you skip ahead to Step 3, the repository will be cloned into a new folder right here in your home folder—~/. If you'd rather be a bit more organized, you can switch to that directory with the cd command first, if the directory already exists.
We suggest keeping all of your CS 70 work together in ~/courses/cs70. To create those directories, make sure you're in your home directory (typing cd with no argument should take you there), and then type
mkdir -p courses/cs70
cd courses/cs70
The -p flag causes mkdir (make directory) to create any “parents” needed to get to the final directory.
You could also run
mkdir -p ~/courses/cs70
cd ~/courses/cs70
or
mkdir courses
cd courses
mkdir cs70
cd cs70
The way to remember
cdis that it's short for “change directory” (where “directory” is a technical term for “folder”)!
It's up to you where you want to work on your assignments, but make sure you remember where you put them!
3. Clone the Repository
Once you've created any container directories and switched into the one where you want your CS70 work to go, run
git clone https://github.com/hmc-cs70-fall2026/repo .git
(
You will be asked for your GitHub credentials. If Git says the repository does not exist, that almost always means you haven't accepted the invitation to join the CS 70 GitHub organization yet rather than that the repository is actually missing.
Let course staff know if you run into any problems with authentication!
If everything goes correctly, you should now have a local copy of the HW1 starter code, saved in the folder you chose in Step 2. Specifically, inside that folder, you should now find a new folder with the same name as your GitHub repository. For example, if you followed our suggestion in Step 2, the downloaded code will be in ~/courses/CS70/.
4. Open the HW1 Starter Code in an Editor
git clone gets you a copy of the files, but to work on them you'll need an editor.
Which Editor?
You are welcome to install Helix locally, so that your own machine works the same way as the server—the install command for your platform is on your setup page above. But you can use whatever editor you like, so long as it does not have AI code completion built in.
Not having AI code completion is the one limitation we have for choosing an editor.
A Word About Visual Studio Code
We prefer that you do not use Visual Studio Code for working on CS 70 code. Its AI features are on by default and switching them off reliably turns out to be harder than it should be—we have tried ourselves, and we cannot guarantee that it will work and won't change with future updates. The difficulty involved in disabling the editor's AI features is a problem with the tool, not with you.
Don't get us wrong—AI-powered code writing can be really useful, and we encourage you to try out the options on your own projects. But CS 70 is about you writing the code yourself so that you can learn the basics, which will help you understand and evaluate code written by others—human or AI.
You can cd into the directory in your terminal where you should be
able to see two subdirectories, fontfun and whereami. Inside
fontfun is the file fontfun.cpp, inside whereami is
whereami.cpp.
5. Prove Your Compiler Works
Build and run the whereami program with
cd whereami
clang++ -std=c++17 -Wall -pedantic -o whereami whereami.cpp
./whereami
The program should print some information describing the machine it was run on.
Each partner should build and run whereami on their own computer and save the output to a file named after themselves:
./whereami > your first name .txt
(Where
Later in the assignment, you'll run the same program on the server, and the two answers will not match—which is the point of having done all this work.
So the file is the proof.
Yes. A screenshot shows what a window looked like;
whereamishows what a compiler and an operating system actually said, which is harder to be accidentally wrong about.
Meh. Couldn't I just type the file myself?
You could. You could also have typed your homework's output instead of running it. We are not trying to catch you out—we are trying to give you something that is easier to do honestly than dishonestly.
Add, Commit, and Push the New File
Next, you will both add the file you created to the Git repository, commit it so it's tracked, and push your changes to GitHub. Do these steps manually, as practice with using the command-line git tool.
Check to make sure that you're in the right directory (HW; if not, cd there), and run
git add your first name .txt
git commit -m "Add whereami output for your first name ."
git push
git addtells Git to track your new filegit commitcommits this change in the local repositorygit pushpushes your change to the remote repository (GitHub)
These are the same three commands you used on the server in Homework 0, and they should work just the same on your machine now.
Get Your Partner's Changes
Once you've both pushed your changes to GitHub, each partner should run
git pull
to get changes from GitHub. Each of you should have both files in your working directory.
(When logged in, completion status appears here.)