Every now and then you might need to pass some options to a C source file before it compiles. It’s rather simple, and useful, but it was a little hard for me to find.

gcc main.c -o main -DLEVI=1
./main

Below is how you could use it in your C program.

#include <stdio.h>

int main() {

#ifdef LEVI
    printf("Levi\n");
#endif

    return 0;
}

resources