【问题标题】:Apple Mach-O Linker (Id) error .. "__objc_empty_cache", need Framework ReferencesApple Mach-O 链接器 (Id) 错误..“__objc_empty_cache”,需要框架参考
【发布时间】:2011-12-24 07:30:48
【问题描述】:

我在我的项目中编写了一个没有任何错误的代码,但是每当我运行该程序时,它都会显示类似的错误。我不明白在哪里可以检查这些错误。请任何人帮助我。

Ld /Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator/Testpicker.app/Testpicker 普通 i386 cd /用户/颜色/桌面/prasad/Testpicker 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/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator -F/Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator -filelist /Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Intermediates/Testpicker.build/Debug-iphonesimulator/Testpicker.build/Objects-normal/i386/Testpicker.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework CoreVideo -framework AVFoundation -framework UIKit -framework CoreGraphics -o /Users/colors/Library/Developer/ Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator/Testpicker.app/Testpicker`

Undefined symbols for architecture i386:
  "_objc_autoreleasePoolPush", referenced from:
      _main in main.o
  "_objc_msgSend", referenced from:
      _main in main.o
      -[ViewController viewDidLoad] in ViewController.o
      -[ViewController changeImage] in ViewController.o
      -[ViewController grabImage] in ViewController.o
      -[ViewController imagePickerController:didFinishPickingImage:editingInfo:] in ViewController.o
      -[ViewController writeImageAsMovie:toPath:size:duration:] in ViewController.o
      -[ViewController newPixelBufferFromCGImage:size:] in ViewController.o
      ...
  "_objc_retainAutoreleasedReturnValue", referenced from:
      _main in main.o
      -[ViewController viewDidLoad] in ViewController.o
      -[ViewController changeImage] in ViewController.o
      -[ViewController grabImage] in ViewController.o
      -[ViewController imagePickerController:didFinishPickingImage:editingInfo:] in ViewController.o
      -[ViewController writeImageAsMovie:toPath:size:duration:] in ViewController.o
      -[ViewController newPixelBufferFromCGImage:size:] in ViewController.o
      ...
  "_NSStringFromClass", referenced from:
      _main in main.o
  "_objc_release", referenced from:
      _main in main.o
      -[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
      -[AppDelegate applicationWillResignActive:] in AppDelegate.o
      -[AppDelegate applicationDidEnterBackground:] in AppDelegate.o
      -[AppDelegate applicationWillEnterForeground:] in AppDelegate.o
      -[AppDelegate applicationDidBecomeActive:] in AppDelegate.o
      -[AppDelegate applicationWillTerminate:] in AppDelegate.o
      ...

  "_objc_setProperty", referenced from:
      -[AppDelegate setWindow:] in AppDelegate.o
      -[ViewController setImgPicker:] in ViewController.o
  "_objc_storeStrong", referenced from:
      -[AppDelegate .cxx_destruct] in AppDelegate.o
      -[ViewController writeImageAsMovie:toPath:size:duration:] in ViewController.o
      -[ViewController .cxx_destruct] in ViewController.o
  "_OBJC_METACLASS_$_NSObject", referenced from:
      _OBJC_METACLASS_$_AppDelegate in AppDelegate.o
      _OBJC_METACLASS_$_ViewController in ViewController.o
  "__objc_empty_cache", referenced from:
      _OBJC_METACLASS_$_AppDelegate in AppDelegate.o
      _OBJC_CLASS_$_AppDelegate in AppDelegate.o
      _OBJC_METACLASS_$_ViewController in ViewController.o
      _OBJC_CLASS_$_ViewController in ViewController.o
  "__objc_empty_vtable", referenced from:
      _OBJC_METACLASS_$_AppDelegate in AppDelegate.o
      _OBJC_CLASS_$_AppDelegate in AppDelegate.o
      _OBJC_METACLASS_$_ViewController in ViewController.o
      _OBJC_CLASS_$_ViewController in ViewController.o
  "_CMTimeMake", referenced from:
      -[ViewController writeImageAsMovie:toPath:size:duration:] in ViewController.o
  "_OBJC_CLASS_$_NSTimer", referenced from:
      objc-class-ref in ViewController.o
  "_OBJC_CLASS_$_NSArray", referenced from:
      objc-class-ref in ViewController.o
  "___CFConstantStringClassReference", referenced from:
      CFString in ViewController.o
      CFString in ViewController.o
      CFString in ViewController.o
      CFString in ViewController.o
      CFString in ViewController.o
      CFString in ViewController.o
  "_OBJC_CLASS_$_NSURL", referenced from:
      objc-class-ref in ViewController.o
  "_OBJC_CLASS_$_NSAssertionHandler", referenced from:
      objc-class-ref in ViewController.o
  "_OBJC_CLASS_$_NSString", referenced from:
      objc-class-ref in ViewController.o
  "_OBJC_CLASS_$_NSDictionary", referenced from:
      objc-class-ref in ViewController.o
  "_OBJC_CLASS_$_NSNumber", referenced from:
      objc-class-ref in ViewController.o
  "_kCFAllocatorDefault", referenced from:
      -[ViewController newPixelBufferFromCGImage:size:] in ViewController.o
  "_kCMTimeZero", referenced from:
      -[ViewController writeImageAsMovie:toPath:size:duration:] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

【问题讨论】:

    标签: ios ios4 xcode4.2


    【解决方案1】:

    您需要将Foundation 框架添加到您的项目中,这是定义这些符号的地方。

    查看 UIKitAVFoundation 框架所在的同一位置,您应该会在其中看到 Foundation。将它拖到您的项目中,一切都应该可以构建。

    【讨论】:

    • 非常感谢。我已经添加了 Foundation 框架,并且我已经包含了 CoreMedia 框架,然后它已经工作了。
    【解决方案2】:

    导入以下框架

    #import <Foundation/Foundation.h>
    #import <AVFoundation/AVFoundation.h>
    #import <CoreMedia/CoreMedia.h>
    

    【讨论】:

      【解决方案3】:

      或者检查您是否缺少下面的 AppDelegate.m(和其他) 目标/构建阶段/编译源。

      当我手动重新添加在 Xcode 之外意外删除的文件时发生这种情况。

      【讨论】:

        【解决方案4】:

        您需要将 Foundation 框架添加到您的项目中,这是定义这些符号的地方。

        #import <Foundation/Foundation.h> in .h file
        

        【讨论】:

          【解决方案5】:

          我在将包含 Objective-c 代码的静态库链接到只有 .c 文件的命令行工具时遇到此错误。添加单个 .m 文件解决了这个问题。

          【讨论】:

            猜你喜欢
            • 2011-10-09
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2012-02-26
            • 2011-12-06
            • 1970-01-01
            相关资源
            最近更新 更多