Bog*_*dan 3 iphone objective-c libxml2 ios
我在xcode工作区中有2个项目.一个是静态库,另一个是静态库.
在静态库中,我添加了GDataXMLNode.h和GDataXMLNode.m文件,我在主项目中使用它们.GDataXMLNode.h是一个公共文件,因此它在主项目中可见.我还将两个项目的目标与libxml2.dylib相关联.我还在头部搜索路径和用户头搜索路径中包含位置/ usr/include/libxml2.
虽然这些,我得到Apple Mach-O Librarian错误:
/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
Run Code Online (Sandbox Code Playgroud)
你知道我怎么解决这个问题?
我最近有完全相同的错误.如您所见,从构建设置中的"其他链接器标志"中删除"-lxml2"有助于解决错误.在构建静态库时也是如此.你将需要在实际包括您的静态库的任何目标链接器标志("-lxml2").例如,如果您像我一样为您的静态库创建单元测试(即MyStaticLibraryProjectTests),那么您需要确保将链接器标志添加到MyStaticLibraryProjectTests目标,而不是添加到实际的MyStaticLibraryProject目标.通常情况下,当我查看"构建设置"选项卡时,我通常会忘记选择特定目标.我通常认为,如果我点击大蓝色项目图标,构建设置仅适用于整个项目,但在修改这些设置时选择正确的目标非常重要.
在大多数项目的早期,通常只有一个目标,但随着您获得更高级,每个项目可能有多个目标.希望有所帮助.
| 归档时间: |
|
| 查看次数: |
11116 次 |
| 最近记录: |