About “Header file not found”

I had a project, which has a static library with references to header files like this:

I couldn’t change this import line, since it was in source files, that are located in static libraries. Also, it is a bad practice to change tons of source files instead of changing just the location of header files folder in the project. I couldn’t realize what should I do, to make Xcode find those header files? I also had a folder with header files, that I can import to the project. I wasted about two days to figure out this problem but at the end I solved it.

The error was the following:

This is the solution.

  1. I created a folder of this structure : Libetpan/libetpan/libetpan.h.
  2. All header files were inside Libetpan/libetpan. Then I put this folder Libetpan to the project next to my *.xcodeproj file.
  3. Then I added this “./Libetpan” to the Build Settings of my Target in Header Search Paths without recursion.

So the most important thing here is that we should put the folder with correct structure to the project. For example, if header is imported this way: #import the folder structure must be Libetpan/libetpan/(header files).

This is the topic in StackOverflow.

Leave a Reply

Your email address will not be published. Required fields are marked *