പ്രീപ്രൊസസ്സർ ഉപയോഗിക്കേണ്ട മാക്രോയെ gcc -D നിർവ്വചിക്കുന്നു.
$ gcc -Dname [options] [source files]
[-o output file]
$ gcc -Dname=definition [options]
[source files] [-o output file]
myfile.c എന്ന സോഴ്സ് ഫയൽ എഴുതുക:
// myfile.c
#include <stdio.h>
void main()
{
#ifdef DEBUG
printf("Debug run\n");
#else
printf("Release run\n");
#endif
}
myfile.c നിർമ്മിച്ച് നിർവചിച്ചിരിക്കുന്ന ഡീബഗ് ഉപയോഗിച്ച് പ്രവർത്തിപ്പിക്കുക:
$ gcc -D DEBUG myfile.c -o myfile
$ ./myfile
Debug run
$
അല്ലെങ്കിൽ myfile.c നിർമ്മിച്ച് ഡീബഗ് നിർവചിക്കാതെ പ്രവർത്തിപ്പിക്കുക:
$ gcc myfile.c -o myfile
$ ./myfile
Release run
$