Clang: error


#1

I’m running: Xcode 4.3.2

I’m getting this build error:

[quote]Undefined symbols for architecture i386:
OBJC_CLASS$_BNRItemStore”, referenced from:
objc-class-ref in ItemsViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)[/quote]

The solution project from chapter 9 builds fine - and I tried copying the files over than the supplied project into mine, and my new project still fails to build.

Any ideas anyone? Is it something to do with the way new projects are created?

Thanks.


#2

this is seems to be a bug in Xcode. to walk around this do the following:
1- select the project form the project navigator pane.
2- from build phases select compile resources. at this point you can see what have caused the problem; BNRItemStore.m was not automatically copied (as it should have been). simply drag BNRItemStore.m to add to to the list.


#3

I had this happen to me a few times, before I finally realized what was happening. When you add the files to the project navigator window, you get window popping up asking you to choose the options for adding these files. We check off the “Copy items into destination group’s folder (if needed)” I think we mostly overlook it, since it’s checked off most of the time, but if you look lower, there’s the section “Add to targets”. I’ve found that checkbox is not checked off, so what happens is that the files get added to the project, but their not included in the compilation, hence the error


#4

Excellent, thank you both very much.

Now working like a charm :slight_smile:


#5

Thanks! it fixed it for me too. I had copied it but not added it to the target.

There was something earlier in the book I just remembered too: When you come across an error, write it down and how it was resolved, for future reference.

I wish I had done this, as this is the second time this error showed up and the first time was too long ago to remember how I fixed it.

Thanks again,

Michael.


#6

I had the same error. Maybe the authors should take this into account for 4th ed :smiley:


#7

Same thing happened to me, and this thread resolved my problemo