GCC directory option -isystem

匿名 (未验证) 提交于 2019-12-03 01:48:02

问题:

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?

回答1:

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 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!