-1

重複の可能性:
XCode、Cocoa アプリケーションでシンボルが見つからない

以下、エラー情報です

Undefined symbols for architecture x86_64:
  "_NSPasteboardTypeString", referenced from:
      _main in main.o
  "_OBJC_CLASS_$_NSPasteboard", referenced from:
      objc-class-ref in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

以下はコードです。さらにヘッダーを含める必要がありますか?

#import <Foundation/Foundation.h>
#import <AppKit/NSPasteboard.h>

int main (int argc, const char * argv[])
{
    @autoreleasepool {
        NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
        NSString *content = [pasteboard stringForType:NSPasteboardTypeString];
        NSLog(@"%@", content);
    }
    return 0;
}
4

1 に答える 1

3

AppKit.framework に対して正しくリンクし、ヘッダーに「実際の」コードが含まれていない

于 2012-12-21T16:39:05.047 に答える