gcc -D पर्याय ध्वज

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 तयार करा आणि DEBUG परिभाषित करून चालवा:

$ gcc -D DEBUG myfile.c -o myfile
$ ./myfile
Debug run
$

 

किंवा myfile.c तयार करा आणि DEBUG परिभाषित केल्याशिवाय चालवा:

$ gcc myfile.c -o myfile
$ ./myfile
Release run
$

 


हे देखील पहा

Advertising

GCC
°• CmtoInchesConvert.com •°