在调试中链接的 .dylib,在 XCode 中找不到用于 iPhone 的发布

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

.dylib linked in Debug, not found for Release for iPhone in XCode

iphonexcode

提问by JWD

So I have included the libxml2.2.dylib library into my iPhone XCode project to create some Xml and XPath parsing utilities. When I compile and run in Debug mode for both the Simulator and Device I have no problems, however, When I switch to Release mode I get...

因此,我已将 libxml2.2.dylib 库包含到我的 iPhone XCode 项目中,以创建一些 Xml 和 XPath 解析实用程序。当我在模拟器和设备的调试模式下编译和运行时,我没有问题,但是,当我切换到发布模式时,我得到...

"error: libxml/tree.h: No such File or directory" as well as other similar errors for the following .h files.

“错误:libxml/tree.h:没有这样的文件或目录”以及以下 .h 文件的其他类似错误。

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

What do I need to do to ensure the libary is included and linked to the Release build?

我需要做什么来确保包含库并将其链接到发布版本?

采纳答案by cdespinosa

An error on the .h is a compile-time error with your Header Search Paths, not a .dylib or a linker error.

.h 上的错误是您的标头搜索路径的编译时错误,而不是 .dylib 或链接器错误。

You have to ensure that ${SDK_DIR}/usr/include/libxml2is in your Header Search Paths in your Release configuration.

您必须确保它${SDK_DIR}/usr/include/libxml2在您的发布配置中的标题搜索路径中。

回答by johndpope

i was going around in circles this morning with this same problem with xcode 4.

今天早上我在兜兜转转,xcode 4 也有同样的问题。

again as described exactly above, it builds with fine with Schema > Build Configuration --> Debug
but fails when switching it to Release

再次如上所述,它使用 Schema > Build Configuration --> Debug构建良好,
但在将其切换到Release时失败

tried numerous cleans and adding ${SDK_DIR}/usr/include/libxml2 or $/usr/include/libxml2 and triple checking Header Search Paths / checking the recursive check box all to no avail. Was about to start a new project when ....

尝试了多次清理并添加 ${SDK_DIR}/usr/include/libxml2 或 $/usr/include/libxml2 并三重检查标题搜索路径/检查递归复选框都无济于事。正要开始一个新项目的时候......

I managed to resolve it by adding
${SDK_DIR}/usr/include/libxml2 to the User Header Search Paths

我设法通过将
${SDK_DIR}/usr/include/libxml2 添加到User Header Search Paths来解决它

回答by henghonglee

do make sure that libxml is included in your project , that was the one that caused the problem for me.

请确保 libxml 包含在您的项目中,这是导致我出现问题的那个。

add libxml2.2.7.3.dylib to linked libraries

将 libxml2.2.7.3.dylib 添加到链接库