Why am I getting this “libxml/tree.h file not foun

2019-01-21 07:41发布

I just installed Xcode version 4.3.1 and I get this error:

libxml / tree.h file not found

I have also installed Xcode 4.2, and with the same project I get the same error.

I have configured the header search paths with /usr/include/libxml2
I also tried $(SDKROOT) / usr/include/libxml2 and it didn't work.

I have also put Other Linker Flag with lxml2

14条回答
孤傲高冷的网名
2楼-- · 2019-01-21 08:03

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.

查看更多
Melony?
3楼-- · 2019-01-21 08:03

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

查看更多
爷、活的狠高调
4楼-- · 2019-01-21 08:08

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

查看更多
姐就是有狂的资本
5楼-- · 2019-01-21 08:11

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.

查看更多
啃猪蹄的小仙女
6楼-- · 2019-01-21 08:11

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)

查看更多
女痞
7楼-- · 2019-01-21 08:15

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!

查看更多
登录 后发表回答