2012-08-29 34 views
2

我是新iPhone开发者。我有这个错误。Xcode error in linker

Ld /Users/c4ntechnology/Library/Developer/Xcode/DerivedData/iPatientCare-azwpvvrjjoaoygfcfqiicwkyssya/Build/Products/Debug-iphonesimulator/iPatientCare.app/iPatientCare normal i386 cd /Users/c4ntechnology/Desktop/iPatientCare setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/c4ntechnology/Library/Developer/Xcode/DerivedData/iPatientCare-azwpvvrjjoaoygfcfqiicwkyssya/Build/Products/Debug-iphonesimulator -F/Users/c4ntechnology/Library/Developer/Xcode/DerivedData/iPatientCare-azwpvvrjjoaoygfcfqiicwkyssya/Build/Products/Debug-iphonesimulator -filelist /Users/c4ntechnology/Library/Developer/Xcode/DerivedData/iPatientCare-azwpvvrjjoaoygfcfqiicwkyssya/Build/Intermediates/iPatientCare.build/Debug-iphonesimulator/iPatientCare.build/Objects-normal/i386/iPatientCare.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -lsqlite3 -framework UIKit -framework AVFoundation -framework CoreGraphics -o /Users/c4ntechnology/Library/Developer/Xcode/DerivedData/iPatientCare-azwpvvrjjoaoygfcfqiicwkyssya/Build/Products/Debug-iphonesimulator/iPatientCare.app/iPatientCare

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

"_OBJC_CLASS_$_ViewController", referenced from:

clang: error: linker command failed with exit code 1 (use -v to see invocation)

请帮我

+0

看起来你错过了一个框架。 –

+0

你有一个叫做ViewController的类吗?如果你这样做,将其导入AppDelegate。如果您不从AppDelegate中移除对ViewController的引用。 –

回答

5

此编译器错误意味着你AppDelegate类引用在项目中ViewController类,但ViewController目前尚未建立被编译并包括在最终产品。

为了确保ViewController类包含在最终产品中,选择左上栏蓝色的Xcode项目图标一样显示在下面的图片:

enter image description here

然后在选择目标然后选择Build Phases选项卡,并确保ViewController.mAppDelegate.m一起包含在列表中,以及其他显示的内容。要添加它,如果它现在不存在,可以拖动它最左边一列的图标并将其放到编译源表格视图中,或者单击该表格视图底部的+按钮。

0

的UIKit的类叫做UIViewController,你最有可能缺少 “UI” 的一部分。您必须导入<UIKit/UIKit.h>以使用此课程,但它很可能已包含在您的MyApp-Prefix.pch中。如果视图控制器是一个类你自己的,你必须:

#import "ViewController.h"