2

My app uses Hpple. I've included, TFHpple.h, TFHpple.m, TFHppleElement.h, TFHppleElement.m, XPathQuery.h & XPathQuery.m. Also included ${SDKROOT}/usr/include/libxml2 and -lxml2.

I have this tiny bit of code:

NSData *data = [[NSData alloc] initWithContentsOfFile:@"example.html"];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:data];


When I try to run it, I receive this error:

"_OBJC_CLASS_$_TFHpple", referenced from: objc-class-ref in test.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't know how to solve this. Any ideas?

jscs
  • 63,694
  • 13
  • 151
  • 195

1 Answers1

4

What exactly do you mean by "I've included" those files? The error indicates that you didn't add TFHpple.m to your target's "Compile Sources" build phase.

Kurt Revis
  • 27,695
  • 5
  • 68
  • 74
  • I had not added to the target's "Compile Sources" build phase. When I added, I received two more errors:"-[TFHpple searchWithXPathQuery:] in TFHpple.o" & "objc-class-ref in TFHpple.o". –  Mar 11 '12 at 21:34
  • I just want to read a XML. Any other good indication for this? Something like that is Hpple, you know? I've been reading about the "TBXML" but I saw that is not so simple. –  Mar 11 '12 at 21:36
  • You need to add all of the .m files in TFHpple to your target. (I pointed out only one, since that's the one that directly caused the first error.) – Kurt Revis Mar 11 '12 at 21:41
  • Hahaha. My little knowledge about it makes me laugh. Thank you a lot, and sorry for my poor knowledge! :-D –  Mar 11 '12 at 21:47
  • 1
    This helped me too. Just wanted to add, in case it's not obvious to anyone else (it wasn't for me), you need to select the .m file, open the file inspector on the right and tick the box(es) under "Target Membership". – Robert Nov 02 '12 at 11:50