DSDS
DSDS

Reputation: 142

How to tell the gcc to look in the include folder for the header files?

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?

Upvotes: 1

Views: 2042

Answers (1)

Sourav Ghosh
Sourav Ghosh

Reputation: 134326

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.

Upvotes: 4

Related Questions