gpt4 book ai didi

iphone - ".../libtool: can' t 找到 : -lxml2"的文件

转载 作者:可可西里 更新时间:2023-11-01 06:23:49 26 4
gpt4 key购买 nike

我在 xcode 工作区中有 2 个项目。一种是静态库,一种是使用静态库。

在静态库中,我添加了我在主项目中使用的 GDataXMLNode.h 和 GDataXMLNode.m 文件。 GDataXMLNode.h 是一个公共(public)文件,因此它在主项目中可见。我还将这两个项目的目标与 libxml2.dylib 链接起来。我还在 header 搜索路径和用户 header 搜索路径中包含位置/usr/include/libxml2。

尽管如此,我还是遇到了 Apple Mach-O 图书管理员错误:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: can't locate file for: -lxml2
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: -lxml2 is not an object file (not allowed in a library)
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libxml2.dylib is a dynamic library, not added to the static library
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libxml2.dylib is a dynamic library, not added to the static library
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool failed with exit code 1

你知道我该如何解决这个问题吗?

最佳答案

我最近遇到了完全相同的错误。如您所见,从build设置中的“其他链接器标志”中删除“-lxml2”有助于解决错误。当您构建静态库时,情况确实如此。您需要在实际包含您的静态库的任何目标中包含该链接器标志(“-lxml2”)。例如,如果您像我一样为静态库创建了单元测试(即 MyStaticLibraryProjectTests),那么您需要确保将链接器标志添加到 MyStaticLibraryProjectTests 目标,而不是实际的 MyStaticLibraryProject 目标。当我去查看我的build设置选项卡时,我通常会忘记选择一个特定的目标。我通常假设,如果我单击蓝色大项目图标,build设置仅适用于整个项目,但在修改这些设置时选择正确的目标非常重要。

大多数项目的早期通常只有一个目标,但随着您变得更高级,每个项目可能有多个目标。希望对您有所帮助。

关于iphone - ".../libtool: can' t 找到 : -lxml2"的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7482285/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com