This assignment has two purposes:
- Get familiar with the git workflow. Match your github username to your student ID.
- Make sure you configure a working C++ environment so that you can build and run the starter code.
-
Insert your information (full name, student id, nethz username) into
my-info.json. -
Commit and push the changes to
my-info.json. For example:git add my-info.json git commit -m "added my information" git push -
Verify that your changes were uploaded to github.com by checking github.com/cmm-25/a0-YOUR_GITHUB_NAME
If you are new to git, there are many tutorials online, e.g. http://rogerdudler.github.io/git-guide/.
This assignement is to make sure your computer and you are both set up for future assignements. For future assignements, you will have to commit and push your solutions to github. Commits (or rather pushes) after the deadline will be disregarded. So make sure you are ready and test out things with this assignment.
Some of the CMM assignments will require you to write code in C++ for performance reasons. We will typically provide you with a skeleton code that you will have to complete.
In A0, our focus is to make sure you have the right software environment to build, run, and test the code. There are three pieces needed to develop and build C++ code: a compiler, CMake, and an editor. In CMM, we recommend a specific set of tools to make your life easier. While we don't enforce the use of these tools, we will not provide support for other setups.
The following instructions will guide you through the setup of these tools. Many setups are dependent on your operating system of choice, so please follow the instructions that match your system.
Compiler generates binary files from your source code i.e. it translates your source code to the form that your machine understands. Compilers vary depending on your operating system.
-
macOS: apple clang
- option1: accompany with Xcode full package (install from AppStore)
- option2: Xcode command line tools(read this)
-
Linux (Ubuntu 20.04): GCC (GCC9 is recommended)
- check your GCC version with
$ gcc --version - if GCC is not installed on your system or if your GCC version is < 9, install GCC9 with
$ sudo apt install gcc-9
- check your GCC version with
-
Windows
- install MSVC C++ build tools from this website
cmake configures your project. It generates makefile that specifies build rules such as which compiler to use, which binary files should be linked together for generating a library or an executable so on. You don't need to know the details of cmake in this course (+ you don't need to do anything about CMakeLists.txt).
Note: During the first cmake configure, the build system will automatically download several dependencies (Eigen, GLFW, ImGui, etc.) from the internet. Make sure you have a working internet connection when you first configure the project.
-
macOS
- CMake is not included with Xcode or the Xcode Command Line Tools. Install it separately:
$ brew install cmake(recommended), or download from cmake.org
- Apple Silicon (M1/M2/M3): Homebrew installs to
/opt/homebrew/bin/. Make sure this is on yourPATH(addexport PATH="/opt/homebrew/bin:$PATH"to your~/.zshrcif needed). - You may see OpenGL deprecation warnings during compilation — these are harmless.
- CMake is not included with Xcode or the Xcode Command Line Tools. Install it separately:
-
Windows
- CMake is not included with MSVC Build Tools by default. You have two options:
- Re-run the Visual Studio installer and check "C++ CMake tools for Windows" under Individual Components, or
- Download and install cmake from cmake.org
- Avoid cloning the project into a path that contains spaces (e.g.
C:\Users\John Doe\...), as this can cause build failures.
- CMake is not included with MSVC Build Tools by default. You have two options:
-
Linux
$ sudo apt install cmake- make sure your cmake is >= 3.12 by
$ cmake --version - Install required system libraries for the GUI (often missing on a fresh install):
sudo apt install libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev
VS Code is a text editor accompanied with some useful tools for build/debug your code. It is probably the best, free code editor for all programming languages and platforms on the market as of 2025. Install the following VS Code extensions.
If you are not familiar with C++ programming, we strongly recommend you to stick to VSCode. It provides a minimal and the easiest setup for C++ programming, yet powerful enough to write/build/debug your code while you conduct your assignments.
Note: MS VISUAL STUDIO and VSCode are completely different tools. Don't be confused!
- If you use Windows, you have to install both: we use build tools installed with MS Visual Studio, but we mainly use VSCode for writing/building/debugging the code.
- If you use mac/Linux, you don't need MS Visual studio at all.
On Windows, you can use Git Bash to perform the steps mentioned below. On linux and MacOS, you can use terminal.
-
Git clone your project, e.g.:
git clone git@github.com:cmm-25/a0-XXX.git -
In VSCode, open the project folder by
File -> Open Folder. Then, if you have already installed the CMake extension, you can do the following:- Select a kit/variant and configure the project. See this for more details (this corresponds to issue
cmake ..in the terminal) - Click "Build" button in status bar (bar at the botton) to compile and run the executable by "Launch" button. (See picture below)
- Then, you can launch the built program by clicking the launch ▶ button in the status bar. If successful, you will see a program pop up (image below)! You can use your mouse to move one ball, but the arrow keys are not working yet. See next step.
- If you want to debug your code, set cmake mode into "CMake: [Debug]" and click "Launch the debugger" button.
- In "CMake: [Debug]" mode, the executable tends to run very slowly. Select "CMake: [Release]" to run the code fast (but in Release mode you cannot use breakpoints).
- Select a kit/variant and configure the project. See this for more details (this corresponds to issue
-
Implement the function
math::addin the filesrc/math/add.cppto make your arrow key work! -
Check if test passed. You can run the test by clicking on the "Testing" extension on the side bar, and run the test by clicking the "Run all tests" button. You should see a green checkmark if the test passed.
- Commit and push changes.


