可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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
回答1:
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
回答2:
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.
回答3:
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
回答4:
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.
回答5:
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.
回答6:
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.
回答7:
The correct path is (for 'Header Search Path'):
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2/**
回答8:
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.
回答9:
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!
回答10:
2 solutions:
- header search path should be updated with SDK root as such:
$(SDKROOT)/usr/include/libxml2
- 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.
回答11:
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
回答12:
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
回答13:
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)
回答14:
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