I have added libxml2 to my Xcode 4 project following this guide.
But it's not working. Xcode gives me error saying it no such libxml2 directory. What am I doing wrong? Here's the screenshots of the target settings of my project:
Thanks.
jazzcat
- add ${SDKROOT}/usr/include/libxml2 to "Header Search Paths" instead of "User Header Search Paths" under yourtarget -> Build Settings -> Search Paths
- link with libxml2.dylib in yourtarget -> Build Phases -> Link Binary With Libraries
- include libxml2 headers with, for instance,
#include <libxml/HTMLparser.h>
and you're off
for better explanation see to this answer https://stackoverflow.com/a/3429301/149663
Adding libxml2.2.dylib For Xcode 7, Xcode 8.0, Xcode 8.1,
Do the following steps,
- Build Phases > Link Binary with Librairies.
- Press "Other" button.
- After file selection appeared, Press "CMD"+"Shift"+"G"
- Type "/usr/lib/"
- Select "libxml2.2.dylib"
Thats all.
You need to change Always Search User Paths
to YES also.
That with "${SDK_DIR}/usr/include/libxml2" on your User header search paths
should work.
In "Other flags" add -lxml2 And also change the Header to ${SDKROOT}/usr/include/libxml2
${SDKROOT}/usr/include/libxml2
来源:https://stackoverflow.com/questions/6012030/adding-libxml2-in-xcode