nsinvocation
nsinvocation

Reputation: 7637

Header file not found in Xcode 7

I'm creating a framework which embeds some C libraries. The C libraries code is exposed to Swift using a .modulemap file. In the Build Settings of the target, under Swift Compiler - Search Paths section I set path to the .modulemap file in Import Paths row. Also under Search Paths section, paths for libraries and headers are set, in Library Search Paths and Header Search Paths rows respectively. After adding framework to the app's project and trying to build app, it fails with error pjsip.h file not found.

enter image description here

enter image description here

The import process starts with highlighted blue file pjsua.h which then imports other headers, those marked with red rectangles.

enter image description here

You can see that imported headers are not living in same folder as pjsua.h as should be for successful import, but isn't this the job of the Header Search Paths to find the headers ? I don't want to mess the structure of the headers folders, cause it's a third party lib and each time it will be updated each time this 'magic' must be done. The include path is defined in Other C Flags row which is same as settings Header Search Paths. I'm not sure what I've missed.

Note:

  1. Headers paths are right.
  2. They don't contain any spaces.

P.S This doesn't help.

Update:

This error is showed only when building for Simulator, building for real device Xcode fails with multiple errors Redefinition of ...

Upvotes: 1

Views: 3368

Answers (1)

nsinvocation
nsinvocation

Reputation: 7637

Solution is simple but ugly. Set Header Search Paths and Search Paths for the main project too. That's definitely not the best way to add a framework to a project because it exposes details about framework but it's the only way to fix the problem.

Upvotes: 2

Related Questions