Installing Visual Studio Code
Start by downloading VSCode here: https://code.visualstudio.com/download, then follow the instructions to install it.
Once it finishes, search for
blank.caltech-vscode-extension-pack in the extensions view (Cmd+Shift+X), and install the extension pack that comes up.
Installing CS 3 Depedencies
Open a terminal and type the following command to install homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then, once homebrew installs, use it to install the SDL dependencies with the following command:
brew install sdl2 sdl2_gfx
Setup Gitlab for CS 3
In the “explorer” tab of VSCode (the top button on the left, the icon looks like two pieces of paper), there will be an option to “Clone Repository”. Note that if you already have a folder open, you will not see this option, so you will need to close the folder first. Once you’ve clicked “Clone Repository”, type in https://gitlab.caltech.edu/cs3/hello-world/ into the box that pops up.
You might be asked for a username and password; if you are, you will need to generate a “token” (as your password) on https://gitlab.caltech.edu/profile/personal_access_tokens (when generating the
token, make sure to click the “API” box). The username is should be your Access username and the “password” is the token that
gitlab provides you. Make sure the “remember” box is checked or save the token somewhere.
Now that the project is created in VSCode, we’re ready to run a simple C program.
First, type Ctrl+~ to open up a terminal. Then, type the command
clang -Wno-nullability-completeness hello.c
to run the program. If it prints out “Hello World”, you are good to go!