0
votes

I have written a code in my project with out any errors but whenever i run the program it shows errors like it. I don't understand where i can check those errors. Please anyone help me.

Ld /Users/colors/Library/Developer/Xcode/DerivedData/Testpicker-dpwydhrdvihgeafvbusqpriesfgj/Build/Products/Debug-iphonesimulator/Testpicker.app/Testpicker normal i386 cd /Users/colors/Desktop/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)
5

5 Answers

11
votes

You need to add the Foundation framework to your project, which is where these symbols are defined.

Look in the same place where UIKit & AVFoundation frameworks live and you should see Foundation in there. Drag it into your project and all should build okay.

5
votes

Import following frameworks

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

Or check if you're missing the AppDelegate.m (and others) under TARGETS / Build Phases / Compile Sources.

Happened me when I manually re-added files I accidentally deleted outside of Xcode.

0
votes

You need to add the Foundation framework to your project, which is where these symbols are defined.

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

I had this error linking a static library which included objective-c code into a Command line tool that had only .c files. Adding a single .m file fixed the problem.