gpt4 book ai didi

GCC 目录选项 -isystem

转载 作者:行者123 更新时间:2023-12-01 18:01:47 24 4
gpt4 key购买 nike

从此链接: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.

运行这个的方法是什么?

[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 $

这是否意味着如果附加了-isystem,该目录将具有普通系统目录的优先级?

最佳答案

documentation说:

-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.

所以你用错了。您需要为 -isystem 选项本身指定一个目录,它不像您似乎正在尝试的那样像 -I 选项的“修饰符”一样工作。

我相信你的命令应该是:

$ gcc -isystem ../include hello.c

System headers获得特殊待遇警告(因为它们是只读的,有些不能用严格一致的代码编写)

关于GCC 目录选项 -isystem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5801754/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com