iPhone SDK将错误与静态库链接起来 [英] iPhone SDK linking errors with static library

查看:93
本文介绍了iPhone SDK将错误与静态库链接起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了自己的静态库,其中包含要在我的项目中重用的组件,并且最近需要更新一堆类。具体来说,由于某些类更改了名称,因此更改了某些方法的签名。

I've built my own static library with components to be reused in my project, and recently had the need to update a bunch of classes. Specifically, some methods' signatures were changed due to the fact that some classes changed names.

现在发生的是库自身编译良好,但是,当添加时到一个应用程序项目,项目无法链接:

What happens now is that the library compiles fine on its own, but, when added to an app project, the project fails to link:

Ld build/Sucursales.build/Debug-iphoneos/Sucursales.build/Objects-normal/armv6/Sucursales normal armv6
cd /Users/nameghino/src/Sucursales
setenv IPHONEOS_DEPLOYMENT_TARGET 3.1
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk -L/Users/nameghino/src/Sucursales/build/Debug-iphoneos -L/Users/nameghino/src/Sucursales/../../Library/MyLibraries/MSSharedLibrary-1.0.0 -F/Users/nameghino/src/Sucursales/build/Debug-iphoneos -filelist /Users/nameghino/src/Sucursales/build/Sucursales.build/Debug-iphoneos/Sucursales.build/Objects-normal/armv6/Sucursales.LinkFileList -dead_strip -lxml2 -ObjC -all_load -miphoneos-version-min=3.1 -framework Foundation -framework UIKit -framework CoreGraphics -lsqlite3.0 -framework CoreLocation -framework MapKit -lxml2 /Users/nameghino/src/MSSharedComponents/Frameworks/MSSharedLibrary/build/Debug-iphoneos/libMSSharedLibrary.a -o /Users/nameghino/src/Sucursales/build/Sucursales.build/Debug-iphoneos/Sucursales.build/Objects-normal/armv6/Sucursales

Undefined symbols:
  "_OBJC_CLASS_$_DataCatalogService_GetSingleRow", referenced from:
      objc-class-ref-to-DataCatalogService_GetSingleRow in libMSSharedLibrary.a(MSDataCatalogSpecification.o)
  **"_OBJC_CLASS_$_DataCatalogService_ArrayOfString", referenced from:
      objc-class-ref-to-DataCatalogService_ArrayOfString in libMSSharedLibrary.a(MSDataCatalogSpecification.o)
  "_OBJC_CLASS_$_DataCatalogService_GetSingleRowResponse", referenced from:
      objc-class-ref-to-DataCatalogService_GetSingleRowResponse in libMSSharedLibrary.a(MSSingleRowResultsParser.o)
  "_OBJC_CLASS_$_DataCatalogService_GetMultiRowResponse", referenced from:
      objc-class-ref-to-DataCatalogService_GetMultiRowResponse in libMSSharedLibrary.a(MSMultiRowResultsParser.o)
  "_OBJC_CLASS_$_DataCatalogService_GetMultiRow", referenced from:
      objc-class-ref-to-DataCatalogService_GetMultiRow in libMSSharedLibrary.a(MSDataCatalogSpecification.o)
  "_OBJC_CLASS_$_DataCatalogService_HelloWorldResponse", referenced from:
      objc-class-ref-to-DataCatalogService_HelloWorldResponse in libMSSharedLibrary.a(DataCatalogService.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status**

奇怪的是,经过大量的项目清理(在应用程序和lib项目中),我仍然得到同样的问题。即使在开始一个新项目之后,问题仍然存在。

The curious thing is that after a lot of project cleanups (both in the app and the lib projects), I still get the same issue. Even after starting a new project, the problem is still there.

我还注意在干净和构建之间重新启动Xcode几次,但是没有好的。

I've also taken care to restart Xcode between a clean and a build a couple of times, but no good.

关于在哪里看的任何想法?

Any ideas on where to look?

推荐答案

有您是否将库添加为项目的依赖项?请参阅 Xcode 3.1.1和静态库

Have you added the library as a dependency to the project? See Xcode 3.1.1 and static libraries

如果向下钻取目标,库名称是否出现在链接二进制
with libraries组中?

If you drill down into your target, does the library name appear in the "Link binary with libraries" group?

查看编译器/链接器输出的日志。找到对链接器的调用。您的库是否出现在要链接的静态库列表中?

Look at the log for the compiler/linker output. Find the call to the linker. Does your library appear on the list of static libraries to link in?

这篇关于iPhone SDK将错误与静态库链接起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆