xcode 构建期间未找到 iPhone libxml2

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

iPhone libxml2 not found during build

iphonexcodelibxml2

提问by Enadeag

I currently got some errors with libxml2 in my iPhone project. This was working before, after making some changes in my build properties building failed. (libxml2.dylib is added in the build phases)

我目前在我的 iPhone 项目中使用 libxml2 遇到了一些错误。这在我的构建属性构建失败后进行了一些更改之前有效。(libxml2.dylib 是在构建阶段添加的)

#import <libxml/tree.h>
#import <libxml/parser.h>
#import <libxml/xmlstring.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>

I've added the following items to the Build Settings:

我已将以下项目添加到构建设置中:

Other Linker Flags: -lxml2
Header Search Paths: /usr/include/libxml2

I've tried adding them to the project and targets (at the same time, and switching between them) without any difference.

我已经尝试将它们添加到项目和目标(同时,并在它们之间切换)而没有任何区别。

I also tried adding the following to the Header Search Path:

我还尝试将以下内容添加到标题搜索路径:

${SDKROOT}
${SDK_DIR}

Both with no result.

两者都没有结果。

Building fails for: iPhone device iPhone and iPad emulator

构建失败:iPhone 设备 iPhone 和 iPad 模拟器

Anyone have an idea?

有人有想法吗?

I'm using the GData Objective-C client library: http://code.google.com/p/gdata-objectivec-client/I'm compiling the source files directly into my project and followed all the steps that are given in the wiki. When manually importing the libxml headers again, XCode suggests the following:

我正在使用 GData Objective-C 客户端库:http: //code.google.com/p/gdata-objectivec-client/我正在将源文件直接编译到我的项目中,并遵循中给出的所有步骤维基。再次手动导入 libxml 标头时,XCode 建议如下:

#import <libxml2/libxml/tree.h>

Which doesn't work either.

这也行不通。

回答by J0S

Add ${SDKROOT}/usr/include/libxml2as a header search path instead of only ${SDKROOT}.

添加${SDKROOT}/usr/include/libxml2为标题搜索路径,而不仅仅是${SDKROOT}.

Watch out that you all build targets that need libxml get the extra search path. If you add the path to your project's build settings, all its targets will inherit it and there shouldn't be a problem.

请注意,所有需要 libxml 的构建目标都会获得额外的搜索路径。如果您将路径添加到项目的构建设置中,则其所有目标都将继承它,应该不会有问题。

回答by pash3r

  • Add libxml2.dylib in Build Phases.
  • Add TFHpple.m, TFHppleElement.m, XpathQuery.m to Build Phases (Compile Sources).
  • Add
    Other Linker Flags: -lxml2 
    Header Search Paths: ${SDK_DIR}/usr/include/libxml2
  • 在构建阶段添加 libxml2.dylib。
  • 将 TFHpple.m、TFHppleElement.m、XpathQuery.m 添加到构建阶段(编译源)。
  • 添加
    Other Linker Flags: -lxml2 
    Header Search Paths: ${SDK_DIR}/usr/include/libxml2

in PROJECT --> Build Phases and in TARGETS --> Build Phases.

在 PROJECT --> Build Phases 和 TARGETS --> Build Phases 中。