Adding libxml2 in XCode

允我心安 提交于 2019-11-28 19:33:37
jazzcat
  1. add ${SDKROOT}/usr/include/libxml2 to "Header Search Paths" instead of "User Header Search Paths" under yourtarget -> Build Settings -> Search Paths
  2. link with libxml2.dylib in yourtarget -> Build Phases -> Link Binary With Libraries
  3. 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,

  1. Build Phases > Link Binary with Librairies.
  2. Press "Other" button.
  3. After file selection appeared, Press "CMD"+"Shift"+"G"
  4. Type "/usr/lib/"
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!