gcc -D skilgreinir fjölvi sem forvinnslumaðurinn notar.
$ gcc -Dname [options] [source files]
[-o output file]
$ gcc -Dname=definition [options]
[source files] [-o output file]
Skrifaðu upprunaskrána myfile.c :
// myfile.c
#include <stdio.h>
void main()
{
#ifdef DEBUG
printf("Debug run\n");
#else
printf("Release run\n");
#endif
}
Byggðu myfile.c og keyrðu það með DEBUG skilgreint:
$ gcc -D DEBUG myfile.c -o myfile
$ ./myfile
Debug run
$
Eða byggðu myfile.c og keyrðu það án þess að DEBUG sé skilgreint:
$ gcc myfile.c -o myfile
$ ./myfile
Release run
$