title: Compile, Build or Archive problems with Xcode 4 (and dependencies)
body: <p>This question has evolved over the past several weeks to cover more general issues with <a href="/questions/tagged/xcode4" class="post-tag" title="show questions tagged &#39;xcode4&#39;" rel="tag">xcode4</a> (and upgrading projects form older <a href="/questions/tagged/xcode" class="post-tag" title="show questions tagged &#39;xcode&#39;" rel="tag">xcode</a>s).</p>
  <p>However many of the issues can be solved by following the same set of instructions.</p>
  <p>If you have any of the following issues, try the methods in the accepted answer:</p>
  <ul>
  <li>Xcode 4 fails to archive an App</li>
  <li>Xcode 4 creates an unusable archive</li>
  <li>Xcode 4 does not create an .ipa</li>
  <li>Xcode 4 fails to compile due to preprocessor errors</li>
  <li>Xcode 4 cannot find headers</li>
  <li>Xcode 4's code complete is not working</li>
  <li>Project dependancies won't compile</li>
  <li>Adding a dependancy causes any of the above issues</li>
  </ul>
  <h2>Original Question</h2>
  <p>Title: <em>&quot;lexical or preprocessor issue file not found&quot; in Xcode 4</em></p>
  <p>I have a project in Xcode 4 that will build fine and run on the device and simulator but when trying to Archive it errors when looking for headers files associated with a static library:</p>
  <pre><code>In file included from /Volumes/Development/Path/LBProject/LBProject/LBProject-Prefix.pch:15:
  In file included from /Volumes/Development/Path/LBProject/LBFDefines.h:23:
  In file included from /Volumes/Development/Path/LBProject/Classes/LBProjectAppDelegate.h:11:
  In file included from /Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDirectoryManager.h:10:
  /Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDataModel.h:11:9: fatal error: 'Merchant.h' file not found [1]
   #import &quot;Merchant.h&quot;
           ^
  1 error generated. 
  </code></pre>
  <p>Xcode gives the error</p>
  <pre><code>lexical or preprocessor issue file not found 
  </code></pre>
  <p><em>Much</em> Googling has show many people are having this issue but no solution. Anyone got a fix or even a clue.</p>
  <p><strong>Update:</strong> The <code>user header</code> search paths are set to <code>${BUILT_PRODUCTS_DIR}</code> in all configurations. It builds fine using any configuration except when archiving.</p>
  <p><strong>Update 2:</strong> <code>Merchant.h</code> is a Core Data class that is auto-generated and therefore inside <code>.xcdatamodeld</code> package, however the headers are all copied to the public headers directory when the library is built.</p>