error: libxml/parser.h: No such file or directory

19,219

Solution 1

As it turns out, it was a trivial fix. I closed the project to work on another, and when I reopened it, the error was gone. Not exactly what I would have expected, but hey, it works now.

"When in doubt, reboot."

Solution 2

Try changing your header search path to ${SDK_DIR}/usr/include/libxml2.

Share:
19,219
Thromordyn
Author by

Thromordyn

Updated on June 20, 2022

Comments

  • Thromordyn
    Thromordyn about 2 years

    I'm attempting to use XML (Chapter 10 in Professional iPhone and iPad Database Application Programming), and I've run into a bit of trouble.

    Under Header Search Paths in Build Settings I have this path:
    /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/libxml2/

    That's all fine and well, but then:

    #import <libxml/parser.h>
    #import <libxml/tree.h>
    error: libxml/parser.h: No such file or directory
    

    If I flip the imports:

    #import <libxml/tree.h>
    #import <libxml/parser.h>
    error: libxml/tree.h: No such file or directory
    

    Weird.

    For now I have this:

    #import <libxml/catalog.h> // Dirty hack
    #import <libxml/parser.h>
    #import <libxml/tree.h>
    error: libxml/catalog.h: No such file or directory
    

    But that's no good for a production app.

  • Thromordyn
    Thromordyn about 13 years
    @Joe Why would that make a difference, though? Upgrading is made a bit easier, but doesn't that path point to the same place? // Edit: Yes it does. Xcode automatically replaced ${SDK_DIR} with what I entered originally. Less time to type, but as I guessed, it is exactly the same.
  • Joe
    Joe about 13 years
    @Thromordyn ya that is strange behavior. You say it is a Dirty Hack because it just does not like your first libxml import correct? So is it compiling just fine when you add a useless include first like catalog.h
  • Thromordyn
    Thromordyn about 13 years
    @Joe The first import is broken, so if I import a pointless file first and let it fail, the other two don't have any trouble. It's "dirty" because it doesn't actually fix the problem, it just lets everything else run. Or something like that. I do plan on having 0 errors if I can figure out how.
  • Joe
    Joe about 13 years
    Thats why I am asking if it is compiling. You are saying that it is a hack so it makes it seem like it compiles but you say it generates an error which make me thinks that it does not compile. And also have you looked inside the folder at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhone‌​OS4.3.sdk/usr/includ‌​e/libxml2/libxml/ and make sure the headers are there?
  • Thromordyn
    Thromordyn about 13 years
    I added that comment before I was done figuring things out. Eheh. Build is successful and there are no problems while running. (The app is pretty simple at this point, but everything looks okay.) // I guess I should have said something before, but I checked .../libxml/, and everything is there. (If it wasn't, I'd be having a slightly different bit of trouble.)
  • Thromordyn
    Thromordyn about 13 years
    The error is still there, it's just not one that stops the app from running. It would blow up in my face if I didn't have #import <libxml/catalog.h> at the top.
  • benjamin.ludwig
    benjamin.ludwig over 10 years
    Plus 1 for the reboot tip :D
  • Sam B
    Sam B about 10 years
    dumb answer that doesn't solve the problem. Right answer is to add ${SDK_DIR}/usr/include/libxml2 to your header search path. add another line below your existing search path