2011-04-18 35 views
0

我读了libxml2在XCode4中可用的地方。但是,运行Product> Profile时出现很多错误。 Adhoc和Debug的当前Header Search Paths设置为:/usr/include/libxml2豹子里的libxml2没有解决?

但是,当我在Snow Leopard中浏览此物理路径时,那里没有libxml2。下面是一个简单的错误:

*:No such file or directory 
Libxml/tree.h: No such file or directory. 

'*' undeclared here (not in a function) 
'XML_ELEMENT_NODE' undeclared here (not in a function) 

'*' undeclared here (not in a function) 
'XML_ATTRIBUTE_NODE' undeclared here (not in a function) 
+1

您使用的是什么版本的XCode?可能是这个问题。而对于iPhone至少它不是内置的,你必须自己添加框架 – Radu 2011-04-18 14:02:34

+0

我目前使用xcode4 – 2011-04-19 02:09:56

回答

2

为你的iPhone应用程序项目打开生成设置,并设置

  • Other linker flags = -lxml2
  • Header Search Paths: $(SDKROOT)/usr/include/libxml2Header Search Paths:/usr/include/libxml2

当在XCode下开发, GCC使用重定位SDK根的-isysroot选项。如果在标题搜索路径中添加/usr/include/libxml2,则它将在编译时转换为当前SDK中的usr/include/libxml2文件夹。

+0

感谢,只有一个评论,在山狮头搜索路径:/ usr/include/libxml2似乎不工作了。 – 2012-10-02 09:01:12