• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 595
  • Last Modified:

Xcode keeps getting headers from other folders

I'm using Xcode 4.2.  For some reason, when I build, it is looking at archived header files in folders outside of my project folder.  I don't see that this archive folder is referenced in any of my project paths.  The archive folder is basically an older copy of my current project folder.  Xcode finds the same header file in this archive and throws a compile error since that creates a duplicate interface.  

How can I find out why Xcode is doing this?
  • 2
1 Solution
I'd open the project file in TextEdit and look for these problematic files there:
In Finder select MyProject.xcodeproj file, then "Show Package Contents" from the popup menu, then, in project.pbxproj file, you can see all referenced files. Make a backup copy of your project before.

Makes sense to check the project settings in Xcode - that you, by mistake,  didn't add the archive folder as a search folder.

If, for example, a.h is a problem header file, find it in Xcode and select in the left panel and check how "Show in Finder" from the popup menu works for this file - it should go to the file loaded in the correct folder and not in an archive.

If you import a header file located in folder A to an m-file located in folder B, you can add a path:
#import "../A/a_header_file.h"
brettrAuthor Commented:
Thanks.  Great help.  I can see in the pbxproj file there are several referenced in this other folder.  Then I go to the project as you mentioned and select one of those files.  Sure enough, Finder opens them in the archive folder.  I'm still working through to resolve it and will accept your answer once I'm past all this.

Do you have any idea how these files got so crossed up?
You are welcome.
I don't know why it happened. :(

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now