libxml/tree.h no such file or directory

Viewed 106024

I am getting following errors.

libxml/tree.h no such file or directory

I have already added libxml2.dylib to my project, however I am getting this type of trouble. Please help me.

22 Answers

Ray Wenderlich has a blog post about using gdata that solves this problem. Basically these simple steps:

In XCode, click Project\Edit Project Settings and make sure “All Configurations” are checked.

Find the Search Paths\Header Search Paths setting and add /usr/include/libxml2 to the list.

Finally, find the Linking\Other Linker Flags section and add -lxml2 to the list.

original post: read and write xml documents with gdataxml

I found that with xCode 4.3.2 I had to enter $(SDKROOT)/usr/include/libxml2 into the Header Search field rather than simply /usr/include/libxml2

As of Mavericks (OS X 10.9) the /usr/include directory is gone. Half of the answers here are obsolete, as the application will not compile until you sort out the include directory.

I solved the problem creating a symbolic link to MacOSX SDK in terminal, using the following command:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include

The application now compiles again.

I'm not sure what the difference is but add the include path to the project as well as the target.

Related