Sainmhíníonn gcc -D macra atá le húsáid ag an réamhphróiseálaí.
$ gcc -Dname [options] [source files]
[-o output file]
$ gcc -Dname=definition [options]
[source files] [-o output file]
Scríobh comhad foinse myfile.c :
// myfile.c
#include <stdio.h/
void main()
{
#ifdef DEBUG
printf("Debug run\n");
#else
printf("Release run\n");
#endif
}
Tóg myfile.c agus rith é le DEBUG sainithe:
$ gcc -D DEBUG myfile.c -o myfile
$ ./myfile
Debug run
$
Nó myfile.c a thógáil agus é a rith gan DEBUG sainithe:
$ gcc myfile.c -o myfile
$ ./myfile
Release run
$