this is mostly taken from the official lecture summary provided on the lecture gitlab page with some additions taken from the lecture slides

1. Version Control

2. Preprocessing/Compiling/Linking

Programs split into several files/libraries, compiled separately and linked:

Screenshot 2024-01-08 at 17.19.55.png

  1. Preprocessor: handles all macros, outputs c++ text file
  2. Compiler & Assembler: convert c++ code to assembly code
  3. Linker: combines compiled .o files to runnable file

C++ preprocessor

Pre-processor macros (cursive = optional)

#define NAME *VALUE* defines variable in code, instances are replaced

#define f(x) std::sin(x) advanced define with parameters

#undef NAME undefine/delete variable

#ifdef NAME checks if variable is defined

#endif close an if-statement

#if #elif #else if/else statements

#error message throw error, printed on console if this point is reached

#include "file.h" #include <system file> pastes file into line, “” looks in current directory first, then where <> looks (can also be relative), <> looks in list of directories known to compiler

Include Guards