Why am I getting this “libxml/tree.h file not found” error?

别等时光非礼了梦想. 提交于 2019-11-28 16:39:43

Include the following in your header search path and you should be immune to any weirdness Apple does with their Xcode updates:

$(SDKROOT)/usr/include/libxml2

In your question, you have a space between the / and usr. Perhaps this is a typo, but the path is:

/usr/include/libxml2

Just confirm that is the path in the target build settings:

You can also verify that the path exists on your file system.

LibXML2 library solved

SOLUTION!

if you have xcode 4.3.x in /Application

need ONLY add: "/usr/include/libxml2" without quote in Application TARGET -> Header search path.

for this -> double click on the line -> on little window click plus sign an write /usr/include/libxml2

nb - need also add libxml2.dylib to the framework. I use 2.2.7.3

hope help you

It appears in 4.3.1, you need to include the Header Search Paths in the Targets as well as the project. I'm not sure if this was an issue with moving from 4.2 to 4.3.1, but I just update to Lion and ran into the same issue.

I solved the problem by setting the Header Search Path to:

${SDK_DIR}/usr/include/libxml2

and Always Search User Paths to NO (which is strongly suggested anyway) This just in the target.

I ran into this again today, I would recommend you wrap the path in quotes:

"$(SDKROOT)/usr/include/libxml2"

I wasted half an hour on this due to having spaces in my path.

The correct path is (for 'Header Search Path'):

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2/**

Xcode 6:

Do the following:

1.0)Select "mainApp" Target : Go to settings ->In "Header Search Path"

1.1)Add this: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2.

2.0)Select "TestApp" Target : Go to settings ->In "Header Search Path"

2.1)Add this: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2.

I have the same problem.

I try set path( 'Header Search Path') to /usr/include/libxml2 ,build error!

I try set path( 'Header Search Path') to $(SDKROOT)/usr/include/libxml2 ,build error!

but I set path to

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2

build succeeded!

2 solutions:

  1. header search path should be updated with SDK root as such: $(SDKROOT)/usr/include/libxml2
  2. Install command line tools for XCode 5 from terminal by entering: xcode-select --install XCode 4 should have the command line tools install option in preferences>downloads section.

I'd personally go with the second one.

I had to configure the other Linker Flags like this: for Debug and Release do Add Build Settings (lower right corner) and Add Conditional Settings. Then, select Any iOS Simulator SDK and insert the Setting -lxml2

AlvaroSantisteban

In my case, the main difficulty was that the app is composed of two projects, with the second one having several targets. It took me a while to realise that the error was occurring in one of those targets and not in the target of the main project. Then I just had to add the (in)famous $(SDKROOT)/usr/include/libxml2 in the Header Search Paths of that particular target.

I am using Xcode Version 5.0.1

I already had the header search path and frame work but was getting this error. Forcefully quitting xcode and then restarting it worked for me (I was using xcode 7.2)

In debug/release add the search path to Any Architecture | Any SDK That is click the + button near debug and add ${SDKROOT}/usr/include/libxml2 Similarly do the above for release also

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!