如何告诉gcc在头文件的include文件夹中查找? [英] How to tell the gcc to look in the include folder for the header files?

查看:176
本文介绍了如何告诉gcc在头文件的include文件夹中查找?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c.我的项目myProject/include中有一个include文件夹,内部有我从Internet下载的SDK中的所有头文件.所以我的问题是如何告诉gcc在include文件夹中查找头文件?

I'm using c. And I have a include folder inside my project myProject/include and inside I have all the header files from the SDK I downloaded from the Internet. So my question is how can I tell the gcc to look for the header files inside the include folder?

推荐答案

您可以将-I选项与gcc一起使用,以告诉路径在哪里查找头文件.

You can use the -I option with gcc to tell the path where to look for the header files.

在线gcc手册

-Idir

将目录dir添加到要搜索头文件的目录列表的开头.因为这些目录是在系统头文件目录之前搜索的,所以可以用来替代您自己的版本来覆盖系统头文件. [...]

-Idir

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

您可以多次使用此选项,

You can use this option multiple times,

[...]如果使用多个-I选项,则将按从左到右的顺序扫描目录;否则,将按照从左到右的顺序扫描目录.标准系统目录随之出现.

[...] If you use more than one -I option, the directories are scanned in left-to-right order; the standard system directories come after.

这篇关于如何告诉gcc在头文件的include文件夹中查找?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆