【发布时间】:2012-07-07 19:26:37
【问题描述】:
我使用的是稍微过时的 Xcode 版本(4.2.1,Apple clang 版本 3.0),这可能是个问题,但是..无论如何这应该可以工作:
我创建了一个新的 Quicklook 插件项目(“File > New > New Project”,然后是“System Plugin > Quick Look Plug-in”)
然后我将GeneratePreviewForURL.c 重命名为GeneratePreviewForURL.m(如提到的in the Apple docs)
如果我尝试使用文件中的任何 Objective-C 代码,我会得到错误。例如,如果我将以下内容添加到 GeneratePreviewForURL 方法中:
#include <Foundation/Foundation.h> // at start of file
NSMutableDictionary *blah;
[blah setValue:@"valuething" forKey:@"keything"];
我收到以下链接器错误:
Undefined symbols for architecture x86_64:
"_objc_msgSend", referenced from:
_GeneratePreviewForURL in GeneratePreviewForURL.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
导致问题的稍微修剪/重组的链接器命令是:
cd ~/QuicklookExample
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang
-arch x86_64 -bundle
-isysroot /Developer/SDKs/MacOSX10.7.sdk
-L/snip -F/snip -filelist /snip/QuicklookExample.LinkFileList
-mmacosx-version-min=10.7
-framework QuickLook
-framework ApplicationServices
-framework CoreServices
-framework CoreFoundation
-o /snip/QuicklookExample
【问题讨论】:
标签: objective-c xcode linker-errors quicklook