title: A C++ header file in a CocoaPod is unable to import from a framework
body: <p>My situation involves a privately developed CocoaPod that contains the OpenCV framework, as well as a wrapper and interface file for working with it. This design is intended to simplify cross-platform sharing for our other apps.</p>
  
  <p>Here is a somewhat crude diagram showing the pieces:</p>
  
  <pre><code>opencv2.framework -&gt; c++ interface file -&gt; objective-c wrapper -&gt; application
  </code></pre>
  
  <p>If I take the first three pieces, and place them directly in the target application, everything works as intended. However, we lose the ability to easily share this across platforms, and we need to manually update the files as changes propagate from the c++ interface.</p>
  
  <p>The problem I am currently seeing, is that when the framework, interface, and wrapper are in a CocoaPod, once imported into the application, the interface file loses the ability to import from the framework (as well as from standard C++ libraries).</p>
  
  <p>Here is the podspec file I am working with the relevant parts:</p>
  
  <pre><code>Pod::Spec.new do |s|
  
  s.name                  = 'PodName'
  s.source                = { :path =&gt; "." }
  s.source_files          = "path/to/source/files/Classes/**/*.{h,mm}", "c++libraryPath/**/*.{h,cpp}"
  s.vendored_frameworks   = 'path/to/framework/file/Frameworks/opencv2.framework'
  s.frameworks            = 'Accelerate', 'AssetsLibrary', 'AVFoundation', 'CoreGraphics', 'CoreImage', 'CoreMedia', 'CoreVideo', 'Foundation', 'opencv2', 'QuartzCore', 'UIKit'
  s.libraries             = 'stdc++'
  
  end
  </code></pre>
  
  <p>In the C++ library file header, we have the following:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;map&gt;
  #include &lt;vector&gt;
  #include &lt;memory&gt;
  
  #include "opencv2/core.hpp"
  </code></pre>
  
  <p>When that file is dropped into the target project, everything works great. However, in a CocoaPod, it fails to find anything in the include statements.</p>
  
  <p>Some things I have tried doing to assist it include:</p>
  
  <ul>
  <li>Setting the file type to C++ header instead of C header </li>
  <li>Checked to make sure the header file has target membership</li>
  </ul>
  
  <p>I also explored the framework search path in Xcode:
  <a href="https://i.stack.imgur.com/wgdNs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wgdNs.png" alt="enter image description here"></a></p>
  
  <p>I have tested without the specific paths to the OpenCV framework, and it makes no difference. I just included this to show that this was tried.</p>
  
  <p>I also tested a very simplified CocoaPod that only consists of the OpenCV framework, and the C++ library class. When I import the CocoaPod with only the framework, I am able to successfully access the methods contained in it. However, once I add the C++ class, it fails to find any includes.</p>
  
  <p>Another item to note. Upon adding the framework to CocoaPods, we found that the links were being broken internally, which caused all kinds of problems. Links were recreated by running the following commands from inside the OpenCV framework:</p>
  
  <pre><code>rm -rf Headers
  ln -s Versions/A/Headers/ .
  rm -rf opencv2
  ln -s Versions/A/opencv2 .
  rm -rf Resources
  ln -s Versions/A/Resources/ .
  </code></pre>