R – Linker error when trying to use MPMoviePlayer

iphonelinkerxcode

On a fresh install of Xcode 3.1.2, I'm trying to use the iPhone MoviePlayer as shown in the sample code at http://developer.apple.com/iphone/library/codinghowtos/AudioAndVideo/index.html#INITIATE_VIDEO_PLAYBACK_IN_MY_CODE

However, Xcode reports the following linker errors when I try to build-n-go:

Building target “EOY” of project “EOY” with configuration “Debug” — (2 errors)
        cd /Users/ed/dev/EOY
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    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.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk -L/Users/ed/dev/EOY/build/Debug-iphonesimulator -F/Users/ed/dev/EOY/build/Debug-iphonesimulator -filelist /Users/ed/dev/EOY/build/EOY.build/Debug-iphonesimulator/EOY.build/Objects-normal/i386/EOY.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/ed/dev/EOY/build/Debug-iphonesimulator/EOY.app/EOY
Undefined symbols:
  ".objc_class_name_MPMoviePlayerController", referenced from:
      literal-pointer@__OBJC@__cls_refs@MPMoviePlayerController in MediaSupport.o
  "_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
      _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in MediaSupport.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
          ".objc_class_name_MPMoviePlayerController", referenced from:
              literal-pointer@__OBJC@__cls_refs@MPMoviePlayerController in MediaSupport.o
          "_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
              _MPMoviePlayerPlaybackDidFinishNotification$non_lazy_ptr in MediaSupport.o
        ld: symbol(s) not found
        collect2: ld returned 1 exit status
Build failed (2 errors)

Best Answer

that is right. Another way to do it is by adding the MediaPlayer to the Project Target by selecting TARGETS->Build Phases->Link Binary with Libraries (here add MediaPlayer)

Related Topic