gcc -I ഓപ്ഷൻ ഫ്ലാഗ്

gcc -I തലക്കെട്ട് ഫയലുകളുടെ ഡയറക്ടറി ഉൾപ്പെടുന്നു.

വാക്യഘടന

$ gcc -Idir [options] [source files] [object files] [-o output file]

ഉദാഹരണം

proj/src/myheader.h:

// myheader.h
#define NUM1 5

 

myfile.c:

// myfile.c
#include <stdio.h/
#include "myheader.h"
 
void main()
{
    int num = NUM1;
    printf("num=%d\n", num);
}

 

പ്രൊജക്റ്റ് / എസ്ആർ‌സി ഡയറക്ടറി ഉൾപ്പെടുത്താതെ myfile.c നിർമ്മിക്കുക :

$ gcc myfile.c -o myfile
myfile.c:2:22: fatal error: myheader.h: No such file or directory
compilation terminated.
$

 

പ്രൊജക്റ്റ് / എസ്‌ആർ‌സി ഉൾപ്പെടുന്ന ഡയറക്‌ടറി ഉപയോഗിച്ച് myfile.c നിർമ്മിക്കുക :

$ gcc -Iproj/src myfile.c -o myfile
$ ./myfile
num=5
$

 


ഇതും കാണുക

Advertising

ജിസിസി
ദ്രുത പട്ടികകൾ