c - -I GCC ( Linux ) 中的标志

标签 c gcc compiler-flags

我找到了一个带有 Makefile 的源文件包,我浏览了一下,在 CFLAG 变量中,有一个 FLAG -I ,我在网上搜索过,但找不到它的实际作用。它与 C 文件中包含的库文件有关吗? (stdio.h,unistd.h,pthread.h)

请指出来源或简要解释一下,Flag -I 的作用是什么?

-问候

最佳答案

它就在 gcc 的手册页中(在 unix/linux 上用 man gcc 调用 or you can find it via Google ):

-I dir

Add the directory dir to the list of directories to be searched for header files. Directories named by -I are searched before the standard system include directories. If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated . If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.

(确切的文本和语义可能因 gcc 版本而异)

或者还有 gcc 在线文档:http://gcc.gnu.org/onlinedocs/例如,版本 4.8.2 的选项可在此处找到:http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Directory-Options.html#Directory-Options

关于c - -I GCC ( Linux ) 中的标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22143781/

相关文章:

c - Linux下的硬件读写函数

ubuntu - 我想将 makefile 的编译器从 pgi 更改为 gfortran,我想知道如何更改 FC 和 FFLAGS 以使其工作

c - 在不修改参数的情况下将指针传递给函数?

linux - 树莓派C程序xxxx段错误

gcc - 无法用gcc编译asm hello world

gcc - 无法在 ubuntu 中编译 cc、gcc |没有这样的文件或目录

c - 如果我用 `-pedantic` 指定 ANSI C 的标准,我还需要 `-std=c89` 吗?

gcc - 如何查看 -march=native 将激活哪些标志?

c - 在 C 中分割从文件读取的字符串很困难

c - 我的库应该处理错误指针输入的 SIGSEGV 吗?