如何告诉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.
-Idir
将目录dir
添加到要搜索头文件的目录列表的开头.因为这些目录是在系统头文件目录之前搜索的,所以可以用来替代您自己的版本来覆盖系统头文件. [...]
-Idir
Add the directorydir
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.