5
votes

using Xcode 3.2.5 on 10.6.6 (10J521) and now 10J537.

I have an Xcode project containing 1 Target: "MyApp". It builds and runs successfully.

As well as source and resource files, the Target contains a "Copy Files" build phase which copies "Sparkle.framework" in. The framework is in the same directory as the project.

I want to duplicate this Target. Steps taken:

  • Did "Clean all Targets".

  • Right-clicked on the "MyApp" Target within Xcode, and then chose "Duplicate".

  • Renamed the duplicated target to "MyAppTarget2".

  • Selected "MyAppTarget2" as the Active Target from the popup menu in the top-left.

  • Did "Build".

The problem:

error: Sparkle/Sparkle.h: No such file or directory

At the line:

#import <Sparkle/Sparkle.h>  // In MyAppDelegate.mm

This is puzzling! Further info:

  • Each Build step appears to have been replicated in the duplicated Target, including the "Copy Files" phase.

  • The Sparkle.framework itself exists in the project's folder.

  • In the "Link Binaries with Library" phase of both "MyApp" and "MyAppTarget2", I am linking to the Sparkle.framework at the above location. A "Get Info" on the linked binary reports that it is a member of both Targets.

  • If I right-click on the Sparkle.framework file within the "Copy Files" build phase of the duplicated Target, and select "Reveal in Finder", then the correct Sparkle.framework file is shown. The required file exists at Sparkle.framework/Headers/Sparkle.h

  • If I switch back to the original "MyApp" target, it builds and runs successfully.

Am I doing something obviously wrong here? Thanks.

[EDIT - SOLVED]

3
Is your new target actually linking the Sparkle framework?Jason Coco
Jason, yes. I've edited the OP to include more info. Cheers.SirRatty

3 Answers

14
votes

I had a look at the Build settings for each supposedly-identical Target.

Under "Framework Search Paths", the first Target had this:

$(inherited) "$(SRCROOT)"

But the duplicated Target had this path:

$(inherited) \"$(SRCROOT)\"

It appears that Xcode incorrectly escaped the path during the duplication process. Ouch.

0
votes

I know you have already solved this issue yourself, but I thought I'd share my fix for this issue (as it has happened to me several times). I've always been able to get rid of this error by deleting the file in question and just recreating it. I have no idea why this works... but, as is often the case with XCode, there seems to be some Voodoo at work.

0
votes

Build Phase copy is still broken in 12.5! It does only copy a few of the source targets build phases. What a crap IDE.