符号未找到objc类引用

时间:2011-04-29 08:13:46

标签: objective-c

"_OBJC_CLASS_$_InputAmountVC", referenced from:

objc-class-ref-to-InputAmountVC in p0931917_prac_2AppDelegate.o

ld: symbol(s) not found
collect2: ld returned 1 exit status

Ld "build/Debug-iphonesimulator/p0931917 prac 2.app/p0931917 prac 2" normal i386
cd "/Volumes/Storage/p0931917 prac 2"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk "-L/Volumes/Storage/p0931917 prac 2/build/Debug-iphonesimulator" "-F/Volumes/Storage/p0931917 prac 2/build/Debug-iphonesimulator" -filelist "/Volumes/Storage/p0931917 prac 2/build/p0931917 prac 2.build/Debug-iphonesimulator/p0931917 prac 2.build/Objects-normal/i386/p0931917 prac 2.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -o "/Volumes/Storage/p0931917 prac 2/build/Debug-iphonesimulator/p0931917 prac 2.app/p0931917 prac 2"

dyld: shared cached file was build against a different libSystem.dylib, ignoring cache
dyld: shared cached file was build against a different libSystem.dylib, ignoring cache
dyld: shared cached file was build against a different libSystem.dylib, ignoring cache
dyld: shared cached file was build against a different libSystem.dylib, ignoring cache
dyld: shared cached file was build against a different libSystem.dylib, ignoring cache
Undefined symbols:
  "_OBJC_CLASS_$_InputAmountVC", referenced from:
      objc-class-ref-to-InputAmountVC in p0931917_prac_2AppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

我有这个错误,请帮助。

1 个答案:

答案 0 :(得分:1)

链接器找不到该特定类的目标代码(二进制)。

如果是您的代码,请确保.m / .mm / .c / .cpp源文件属于您正在构建的目标。

如果它在库中,请确保链接器可以找到它(库搜索路径等),并且实际上是使用相同的设置构建的。

关于 dyld 的后一段看起来像你的问题就是:dyld是针对另一个版本的libSystem.dylib构建的,而不是你当前的目标,所以基本上它没有代码你需要它。 (其他架构或基础SDK?)