Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC directory option -isystem

Tags:

gcc

From this link: http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html

If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option will be ignored. The directory will still be searched but as a system directory at its normal position in the system include chain.

What is the way to run this?

[14:45:37 Wed Apr 27] ~/junkPrograms/src  $gcc hello.c -isystem -I ../include/
../include/: file not recognized: Is a directory
collect2: ld returned 1 exit status
[14:45:42 Wed Apr 27] ~/junkPrograms/src  $gcc hello.c -I isystem ../include/
../include/: file not recognized: Is a directory
collect2: ld returned 1 exit status
[14:45:57 Wed Apr 27] ~/junkPrograms/src  $

and does this mean that if -isystem is attached, the dir will be given the precedence of a normal system dir?

like image 963
Aquarius_Girl Avatar asked Apr 27 '11 09:04

Aquarius_Girl


1 Answers

The documentation says:

-isystem dir

Search dir for header files, after all directories specified by -I but before the standard system directories. Mark it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. If dir begins with =, then the = will be replaced by the sysroot prefix; see --sysroot and -isysroot.

So you're using it wrong. You need to specify a directory for the -isystem option itself, it doesn't work like a "modifier" of the -I option like you seem to be trying.

I believe your command should be:

$ gcc -isystem ../include hello.c

System headers get special treatment w.r.t. warnings (since they are read only, and some cannot be written in strictly conforming code)

like image 80
unwind Avatar answered Oct 05 '22 15:10

unwind