ios xcode 更新后找不到 #import <libxml/tree.h> 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14622684/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:05:00  来源:igfitidea点击:

#import <libxml/tree.h> file not found after xcode update

iosxcodelibxml2

提问by Bongeh

Lastnight I updated my iPhone to iOS 6.1, my current version of xcode wouldn't build to the phone as I needed the newest version.

昨晚我将我的 iPhone 更新到了 iOS 6.1,我当前版本的 xcode 无法构建到手机上,因为我需要最新版本。

I went from xcode 4.5.2 to xcode 4.6, I made 0 changes in my project file.

我从 xcode 4.5.2 到 xcode 4.6,我在我的项目文件中做了 0 个更改。

What used to compile completely fine, now gives me a file not found error

以前编译完全没问题,现在给我一个找不到文件的错误

#import <libxml/tree.h> 'libxml/tree.h' file not found

I have my search paths correctly linked up with

我的搜索路径与

$(SDKROOT)/usr/include/libxml2

and libxml2 is linked and required in build phases.

并且 libxml2 在构建阶段被链接和需要。

Edit:

编辑:

Peculiar I changed my search paths to the following and voila..

奇怪的是,我将搜索路径更改为以下内容,瞧..

/usr/include/libxml2

Not sure why this has fixed this issue, could anyone enlighten me as to what's changed in xcode?

不知道为什么这解决了这个问题,有人可以启发我了解 xcode 中的变化吗?

回答by Aaron Bratcher

In your build settings, add the following to your Header Search Paths:

在您的构建设置中,将以下内容添加到您的标题搜索路径:

$SDKROOT/usr/include/libxml2

回答by chris

For me what worked was adding this to header search path:

对我来说,有效的是将它添加到标题搜索路径:

$(SDKROOT)/usr/include/libxml2

Slightly difference from other answer, probably to do with newer version of Xcode.

与其他答案略有不同,可能与较新版本的 Xcode 有关。

回答by ylgwhyh

add: $SDKROOT/usr/include/libxml2

添加:$SDKROOT/usr/include/libxml2

enter image description here

在此处输入图片说明

回答by Hongli Yu

In Xcode6 and latest versions add this to your Header Search Paths:

在 Xcode6 和最新版本中,将此添加到您的标题搜索路径:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2

and remember to add the search path also to the test target.

并记住将搜索路径也添加到测试目标。

回答by Oded BD

I upgraded libxml2 on my mac and then:

我在我的 mac 上升级了 libxml2,然后:

If you need to have libxml2 first in your PATH run:                                                                                                                                                                                             
  echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc

For compilers to find libxml2 you may need to set:
  export LDFLAGS="-L/usr/local/opt/libxml2/lib"
  export CPPFLAGS="-I/usr/local/opt/libxml2/include"

For pkg-config to find libxml2 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"