xcode 为什么我会收到此“找不到 libxml/tree.h 文件”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9666804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why am I getting this "libxml/tree.h file not found" error?
提问by Sergio Rodríguez
I just installed Xcode version 4.3.1 and I get this error:
我刚刚安装了 Xcode 4.3.1 版,但出现此错误:
libxml / tree.h file not found
找不到 libxml/tree.h 文件
I have also installed Xcode 4.2, and with the same project I get the same error.
我还安装了 Xcode 4.2,在同一个项目中我得到了同样的错误。
I have configured the header search pathswith /usr/include/libxml2
I also tried $(SDKROOT) / usr/include/libxml2
and it didn't work.
我已经配置了标题搜索路径,/usr/include/libxml2
我也试过了$(SDKROOT) / usr/include/libxml2
,但没有用。
I have also put Other Linker Flagwith lxml2
我也把其他链接器标志与lxml2
回答by jmstone617
Include the following in your header search path and you should be immune to any weirdness Apple does with their Xcode updates:
在您的标题搜索路径中包含以下内容,您应该不受 Apple 对其 Xcode 更新所做的任何怪异行为的影响:
$(SDKROOT)/usr/include/libxml2
回答by FluffulousChimp
In your question, you have a space between the /
and usr
. Perhaps this is a typo, but the path is:
在您的问题中,/
和之间有一个空格usr
。也许这是一个错字,但路径是:
/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.
您还可以验证文件系统上是否存在该路径。
回答by sundsx
LibXML2 library solved
LibXML2 库解决
SOLUTION!
解决方案!
if you have xcode 4.3.x in /Application
如果 /Application 中有 xcode 4.3.x
need ONLY add: "/usr/include/libxml2" without quote in Application TARGET -> Header search path.
只需要在 Application TARGET -> Header 搜索路径中添加:"/usr/include/libxml2" 不带引号。
for this -> double click on the line -> on little window click plus sign an write /usr/include/libxml2
为此 -> 双击该行 -> 在小窗口上单击加号写入 /usr/include/libxml2
nb - need also add libxml2.dylib to the framework. I use 2.2.7.3
nb - 还需要将 libxml2.dylib 添加到框架中。我使用 2.2.7.3
hope help you
希望能帮到你
回答by Giulio
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.
并且始终搜索 NO 的用户路径(无论如何强烈建议)这只是在目标中。
回答by Russ Newcomer
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.
它出现在4.3.1中,您需要在Targets以及项目中包含Header Search Paths。我不确定这是否是从 4.2 迁移到 4.3.1 的问题,但我刚刚更新到 Lion 并遇到了同样的问题。
回答by Chris
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.
由于路径中有空格,我在此浪费了半个小时。
回答by ArunDhwaj IIITH
Xcode 6:
代码 6:
Do the following:
请执行下列操作:
1.0)Select "mainApp" Target : Go to settings ->In "Header Search Path"
1.0)选择“mainApp”目标:转到设置->在“标题搜索路径”中
1.1)Add this: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2.
1.1) 添加这个:/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.0)选择“TestApp”目标:转到设置->在“标题搜索路径”中
2.1)Add this: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2.
2.1) 添加这个:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2。
回答by ingaham
The correct path is (for 'Header Search Path'):
正确的路径是(对于“标题搜索路径”):
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2/**
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2/**
回答by jasonhao
I have the same problem.
我也有同样的问题。
I try set path( 'Header Search Path') to /usr/include/libxml2
,build error!
我尝试将路径('标题搜索路径')设置为/usr/include/libxml2
,构建错误!
I try set path( 'Header Search Path') to $(SDKROOT)/usr/include/libxml2
,build error!
我尝试将路径('标题搜索路径')设置为$(SDKROOT)/usr/include/libxml2
,构建错误!
but I set path to
但我设置了路径
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/libxml2
build succeeded!
构建成功!
回答by Feras Arabiat
2 solutions:
2个解决方案:
- 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.
- 标头搜索路径应使用 SDK 根更新,如下所示:
$(SDKROOT)/usr/include/libxml2
- 通过输入从终端安装 XCode 5 的命令行工具:
xcode-select --install
XCode 4 应该在首选项>下载部分有命令行工具安装选项。
I'd personally go with the second one.
我个人会选择第二个。