"Header Search Paths" Vs. "Library Search Paths"

1.9k Views Asked by At

What's the difference between "Header Search Paths" and "Library Search Paths"? When should I add paths to one vs. the other?

I've noticed that when I link my binary with a library, Xcode automatically adds that library's search path to "Library Search Paths." I've also used "Header Search Paths" for cross-referenced projects. Is there more to it than that?

2

There are 2 best solutions below

0
On

Headers are files which are #included or #imported. Libraries are things you link against. They are different things. So, they are found in different places and the search paths are used to specify those.

0
On

You cannot use your binary without headers. They are some kind of "instructions" what to do with your binary. And your headers can be placed to the different place. In this case it will be very useful to have possibility to set different search path for your binary and for it's headers.

For example, if you want to use some part of your project as static library, you will create the separate target, after building it will appear in build directory as compiled lib file. For use this lib, your project must have info about library headers.