Build fails with a link error


#1

Hi,

I’m following this chapter and I’m up to the point where we have added the code to HomepwnerAppDelegate.m to save the data in applicationDidEnterBackground: and applicationWillTerminate:, but when I build and run I get a link error.

[quote]Undefined symbols for architecture armv7:
"_pathInDocumentDirectory", referenced from:
-[PossessionStore possessionArchivePath] in PossessionStore.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
[/quote]

I’m trying to run it on my device, an iPhone 4 running iOS 5. I’m also using Xcode 4.2.

Because of the template differences I took the initial Homepwner code from your supplied files in the first chapter that referenced it, and have manually typed everything since then.

I’m guessing that this is just some compatibility issue between iOS 4.2 and 5, or with the default settings of Xcode 4.2, but if you have any ideas that might solve this it would be appreciated.

Thanks
Craig


#2

Hi,

Looks like there is a problem with your FileHelpers files.

Check that you have FileHelpers.h and FileHelpers.m in your project.

Check that Homepwner-Prefix.pch has

#ifdef OBJC
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import “FileHelpers.h”
#endif

Check that the app Target has FileHelpers.m in the list of Compile Sources in the Build Phases tab.

Hopefully that will sort it.

Gareth


#3

Hi Gareth,

I was hoping that this might be a quick fix, but unfortunately all those files are in the correct places.

I’ll continue searching for a solution.

Thanks
Craig


#4

Ok, it’s obviously something that I have missed.

I said that I took the base files from chapter 10 and added the code from the book to that, and it doesn’t work.

But if I open and run the files from chapter 15 it works fine, so it must be something that I have missed.

False alarm, sorry everyone!

  • Craig