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 ಅನ್ನು ನಿರ್ಮಿಸಿಮತ್ತು ಡೀಬಗ್ ಅನ್ನು ವ್ಯಾಖ್ಯಾನಿಸಿ ಅದನ್ನು ರನ್ ಮಾಡಿ:

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

 

ಅಥವಾ myfile.c ಅನ್ನು ನಿರ್ಮಿಸಿ ಮತ್ತು ಡೀಬಗ್ ಅನ್ನು ವ್ಯಾಖ್ಯಾನಿಸದೆ ಚಲಾಯಿಸಿ:

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

 


ಸಹ ನೋಡಿ

Advertising

GCC
°• CmtoInchesConvert.com •°