2010-08-03 65 views
28

我參照http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html來從iPhone攝像頭捕捉視頻。除了該頁面的代碼外,這是一個新的項目。我還將AVFoundation框架添加到項目中。這裏的鏈接錯誤,我得到:AVFoundation爲什麼不能鏈接到我的XCode 3.2.3 iPhone 4.0.1項目?

Build my project of project my project with configuration Debug 

CompileC "build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv6/MainViewController.o" /Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m normal armv6 objective-c com.apple.compilers.gcc.4_2 
cd /Users/mwilliamson/Projects/my_project/iphone 
setenv LANG en_US.US-ASCII 
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -x objective-c -arch armv6 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -fvisibility=hidden -gdwarf-2 -mthumb -miphoneos-version-min=4.0 -iquote "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-generated-files.hmap" "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-own-target-headers.hmap" "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-all-target-headers.hmap" -iquote "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-project-headers.hmap" -F/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos -I/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos/include -I/Users/mwilliamson/Projects/my_project/iphone/opencv_device/include "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/DerivedSources/armv6" "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/DerivedSources" -include /var/folders/kW/kW6u6B7SGyGYu+nNumtIa++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/my_project_Prefix-alujyqxskcuyuogdsynmjyrkxbhh/my_project_Prefix.pch -c /Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m -o "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv6/MainViewController.o" 

/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m: In function '-[MainViewController captureOutput:didOutputSampleBuffer:fromConnection:]': 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: 'MainViewController' may not respond to '-imageFromSampleBuffer:' 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: (Messages without a matching method signature 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: will be assumed to return 'id' and accept 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: '...' as arguments.) 

Ld "build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv6/my project" normal armv6 
cd /Users/mwilliamson/Projects/my_project/iphone 
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0 
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -L/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos -F/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos -filelist "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv6/my project.LinkFileList" -dead_strip -lz -lstdc++ /Users/mwilliamson/Projects/my_project/iphone/opencv_device/lib/libcxcore.a /Users/mwilliamson/Projects/my_project/iphone/opencv_device/lib/libcv.a -miphoneos-version-min=4.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -o "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv6/my project" 

Undefined symbols: 
    "_CVPixelBufferGetBaseAddress", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferUnlockBaseAddress", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferLockBaseAddress", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CMSampleBufferGetImageBuffer", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferGetHeight", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_kCVPixelBufferPixelFormatTypeKey", referenced from: 
     _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr in MainViewController.o 
    (maybe you meant: _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr) 
    "_CVPixelBufferGetWidth", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferGetBytesPerRow", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CMTimeMake", referenced from: 
     -[MainViewController setupCaptureSession] in MainViewController.o 
    "_CVPixelBufferGetDataSize", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 

CompileC "build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv7/MainViewController.o" /Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m normal armv7 objective-c com.apple.compilers.gcc.4_2 
cd /Users/mwilliamson/Projects/my_project/iphone 
setenv LANG en_US.US-ASCII 
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -x objective-c -arch armv7 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -fvisibility=hidden -gdwarf-2 -mthumb -miphoneos-version-min=4.0 -iquote "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-generated-files.hmap" "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-own-target-headers.hmap" "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-all-target-headers.hmap" -iquote "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/my project-project-headers.hmap" -F/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos -I/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos/include -I/Users/mwilliamson/Projects/my_project/iphone/opencv_device/include "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/DerivedSources/armv7" "-I/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/DerivedSources" -include /var/folders/kW/kW6u6B7SGyGYu+nNumtIa++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/my_project_Prefix-gtrotaxhqdjhgqbqbsnyeqjkaxdt/my_project_Prefix.pch -c /Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m -o "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv7/MainViewController.o" 

/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m: In function '-[MainViewController captureOutput:didOutputSampleBuffer:fromConnection:]': 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: 'MainViewController' may not respond to '-imageFromSampleBuffer:' 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: (Messages without a matching method signature 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: will be assumed to return 'id' and accept 
/Users/mwilliamson/Projects/my_project/iphone/Classes/MainViewController.m:126: warning: '...' as arguments.) 

Ld "build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv7/my project" normal armv7 
cd /Users/mwilliamson/Projects/my_project/iphone 
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0 
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -L/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos -F/Users/mwilliamson/Projects/my_project/iphone/build/Debug-iphoneos -filelist "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv7/my project.LinkFileList" -dead_strip -lz -lstdc++ /Users/mwilliamson/Projects/my_project/iphone/opencv_device/lib/libcxcore.a /Users/mwilliamson/Projects/my_project/iphone/opencv_device/lib/libcv.a -miphoneos-version-min=4.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -o "/Users/mwilliamson/Projects/my_project/iphone/build/my project.build/Debug-iphoneos/my project.build/Objects-normal/armv7/my project" 

Undefined symbols: 
    "_CVPixelBufferGetBaseAddress", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferUnlockBaseAddress", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferLockBaseAddress", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CMSampleBufferGetImageBuffer", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferGetHeight", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_kCVPixelBufferPixelFormatTypeKey", referenced from: 
     _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr in MainViewController.o 
    (maybe you meant: _kCVPixelBufferPixelFormatTypeKey$non_lazy_ptr) 
    "_CVPixelBufferGetWidth", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CVPixelBufferGetBytesPerRow", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
    "_CMTimeMake", referenced from: 
     -[MainViewController setupCaptureSession] in MainViewController.o 
    "_CVPixelBufferGetDataSize", referenced from: 
     -[MainViewController imageFromSampleBuffer:] in MainViewController.o 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 

回答

76

再次,我回答我的問題....我需要添加corevideo的和CoreMedia框架了。

+6

謝謝馬特我有同樣的錯誤。 – 2010-08-03 15:27:07

+1

謝謝解決我的問題 – aryaxt 2010-08-21 23:02:56

+5

謝謝。涼。 CMTime是CoreMedia框架的一部分。 – 2010-12-03 11:09:32

2

我花了幾個小時與這個問題的變化掙扎。我發佈此信息以幫助任何可能處於相同情況的人。我已經將CoreVideo & CoreMedia鏈接到我的項目中。但是,我仍然遇到這個問題。經過大量的搜索和嘗試不同的事情後,我遇到了這篇文章。這是我的修復:

1)刪除有問題的庫(CoreVideo和CoreMedia在我的情況)。通過刪除他們在該項目的資產淨值,並選擇「刪除引用」,並從鏈接的框架,「構建階段」

2移除它們)再次添加框架,乾淨,並重新編譯做到這一點。

相關問題