जीसीसी-डी विकल्प ध्वज

जीसीसी-डी प्रीप्रोसेसर द्वारा उपयोग किए जाने वाले मैक्रो को परिभाषित करता है।

वाक्य - विन्यास

$ 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

जीसीसी
°• CmtoInchesConvert.com •°