libxml/tree.h no such file or directory

Works for me. Remember to add the library in Link Binary en Build Phases Section of the target project. pic2 pic1


You need to put all the libxml headers on the include path. For Xcode do this by adding/usr/include/libxml2 to the header paths (that will pass -I/usr/include/libxml2 to the c compiler)

This is in the build settings tab in Search Paths -> Header Search Paths

enter image description here


There's just a few simple steps:

  • Copy the RaptureXML/RaptureXML folder into your own project and import "RXMLElement.h" somewhere (e.g., your PCH file).
  • Link in libz.dylib to your target.
  • Link in libxml2.dylib to your target.
  • In your build settings, for the key "Header Search Paths", add "$(SDK_DIR)"/usr/include/libxml2

RaptureXML supports ARC. In fact, it does so without a branch. The code automatically detects if ARC is being used in your project and compiles accordingly. You are free to use any version of LLVM or gcc as well! (Though you should be using LLVM by now.)


Adding libxml2 in Xcode 4.3.x

Adding libxml2 is a big, fat, finicky pain in the ass. If you're going to do it do it before you get too far in building your project.

Here's how.

Target settings

Click on your target (not your project) and select "Build Phases". Click on the reveal triangle titled "Link Binary With Libraries". Click on the "+" to add a library. Scroll to the bottom of the list and select "libxml2.dylib". That adds the libxml2 library 2 your project… but wait.

Project settings

Now you have to tell your project where to look for it three more times.

Select the "Build Settings tab". Scroll down to the "Linking" section. Under your project's columns double click on the "Other Linker Flags" row. Click the "+" and add "-lxml2" to the list.

Still more.

In the same tab, scroll down to the "Search Paths" section. Under your project's column in the"Framework Search Paths" row add "/usr/lib/libxml2.dylib".

In the "Header Search Paths" AND the "User Header Search Paths" row add"$(SDKROOT)/usr/include/libxml2". In those last two cases make sure that path is entered in Debug AND Release.

Then. Under the "Product" Menu select "Clean".

Then, if I were you (and let's face it I probably am) I'd quit Xcode and walk away. When you come back and launch you should be good to go.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值