加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – – 我与系统目录相对应

发布时间:2020-12-16 03:12:05 所属栏目:百科 来源:网络整理
导读:如果我想要包括要搜索头文件的目录,哪个是首选方式,为什么? 解决方法 从 gcc documentation for -I: Add the directory dir to the head of the list of directories to be searched for header files. This can be used to override a system header file
如果我想要包括要搜索头文件的目录,哪个是首选方式,为什么?

解决方法

从 gcc documentation for -I:

Add the directory dir to the head of the list of directories to be searched for header files. This can be used to override a system header file,substituting your own version,since these directories are searched before the system header file directories. However,you should not use this option to add directories that contain vendor-supplied system header files (use -isystem for that). If you use more than one -I option,the directories are scanned in left-to-right order; the standard system directories come after.

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. This is to ensure that GCC’s procedure to fix buggy system headers and the ordering for the include_next directive are not inadvertently changed. If you really need to change the search order for system directories,use the -nostdinc and/or -isystem options.

所以,除了特殊情况(如供应商提供的系统头),我可能是指定头文件位置的首选方法.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读