How to tell the gcc to look in the include folder

2019-07-25 00:57发布

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?

1条回答
手持菜刀,她持情操
2楼-- · 2019-07-25 01:51

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

From online gcc manual

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

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

查看更多
登录 后发表回答