- TP0: Introduction to C, and VSCode (making sure you can debug)
- TP1: Simple data types and pointers
- TP2: Stack, Queue, List
- TP3: Trees, AVL Trees
- TP4: Graphs
- TP5: Hashing, Hash Tables, chaining, linear probing
If not installed, download and install Visual Studio Code. If not installed, install it with:
Make sure you install the C/C++ extension for VSCode. This should provide intellisense, code navigation, and debugging features.
If you are on Windows, follow this tutorial:
- install MSYS2 and always run commands from MSYS2's terminal.
- Execute
pacman -Syu
to update the package list (hit 'Y' when prompted). Re-start MSYS2 and do the same forpacman -Su
. - Search for MINGW in the start menu and open the MINGW64 terminal.
- Run
pacman -S mingw-w64-x86_64-gcc
to install the GNU C Compiler. - Run
pacman -S mingw-w64-x86_64-gdb
to install the GNU Debugger. - Run
pacman -S mingw-w64-x86_64-cmake
to install CMake. - Add the
bin
directory of MSYS2 to your system's PATH environment variable. This is usuallyC:\msys64\mingw64\bin
. - If not yet installed, install git from the official website.
Linux:
- Run
sudo apt-get update
to update the package list. - Run
sudo apt-get install gcc
to install the GNU C Compiler. - Run
sudo apt-get install gdb
to install the GNU Debugger. - Run
sudo apt-get install cmake
to install CMake. - If not yet installed (check with
git --version
), install git withsudo apt-get install git
.
MacOS:
- Install Homebrew. This is a package manager for MacOS. You can install it by running the following command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Run
brew install gcc
to install the GNU C Compiler. - Install VSCode (next section) and install the CodeLLDB extension for VSCode. You will use
lldb
instead ofgdb
for debugging. - Run
brew install cmake
to install CMake. - If not yet installed (check with
git --version
), install git withbrew install git
.
You should now be able to debug your code!
Do the following steps to run tp0:
- Open
src/tp0/main.c
in VSCode. - Add a breakpoint (red dot) on line 15.
- Select "Run and Debug" from VSCode's sidebar, then select "tp0 macos", "tp0 linux" or "tp0 windows" from the top-left dropdown menu depending on your OS.
- Press the green play button to start debugging. If the code stops at the breakpoint, you are ready to go!
We are going to create GitLab and GitHub projects. Make sure you make them private !
- (Optional) Go to gitlab and create a new project called
std2024
. - Go to your personal github and create a new project called
std2024
. Add Brian.Pulfer@unige.ch, Arthur.Freeman@etu.unige.ch and Ethan.Arm@etu.unige.ch as collaborators. - Inside the
std2024
directory, run the following commands to set-up the git repos (only once):
git init # Initializes the git repo
git remote add origin LINK_TO_GITHUB_REPO # Adds the github repo as upstream
git remote add gitlab LINK_TO_GITLAB_REPO # Adds the gitlab repo as upstream (Optional)
git branch -m main # Renames the branch to main
git add . # Adds all files to the staging area
git commit -m "Initial commit." # Commits the changes
git push -u origin main # Pushes the code to github --> Tests are triggered!
git push -u gitlab main # Pushes the code to gitlab (Optional)
The workflow is as follows:
- When given a new assignment, you will have to implement the functions in the
/lib
directory (e.g.lib/list/list.h
andlib/list/list.c
), as well as in the main file for that assignment (e.g./src/tp2/main.c
). - Once you have implemented the functions, you can test them by pushing your code to GitHub:
git add .
git commit -m "My commit message."
git push # (pushes to gitlab)
git push github # (pushes to github) -> Monitor the tests on GitHub
- If all tests pass, you are done! If not, go back to step 1.
- Teaching Assistant: Brian Pulfer
- Monitors: Arthur Freeman, Ethan Arm