XCode链接构建错误 [英] XCode Linking build error

查看:136
本文介绍了XCode链接构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这对我来说是新的。甚至不确定RootViewController.o是什么?虽然这个项目有 .m & .h 。建筑模拟器3.0。在构建之前清理(Shift-⌘-K)。



最近添加了一些类,从另一个项目,也有一个RootViewController ...但我没有转移旧的。从来没有建立。

使用配置Debug构建项目MyApp的目标MyApp - (1错误) strong>

  cd/ Volumes / MacHD / Development / iPhone / MyApp
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.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -L / Volumes / MacHD / Development / iPhone / MyApp / build / Debug-iphonesimulator -F / Volumes / MacHD / Development / iPhone / MyApp / build / Debug-iphonesimulator -filelist /Volumes/MacHD/Development/iPhone/MyApp/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects - 正则/ i386 / MyApp.LinkFileList -mmacosx-version-min = 10.5 -framework基础-framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -o / Volumes / MacHD / Development / iPhone / MyApp / build / Debug-iphonesimulator / MyApp.app/MyApp
未定义的符号:
.objc_class_name_MyViewController,引用自:
literal-pointer @__ OBJC @__ cls_refs @ RootViewController.o中的MyViewController
ld:symbol )未找到
collect2:ld返回1退出状态

构建失败/ p>




编辑:清除所有目标...仍然无法构建。这是我的#includes:



RootViewController.h

 code> #import< UIKit / UIKit.h> 
#importMyViewController.h//尝试这个和作为@class MyViewController

@class AddViewController,EditingViewController;

@interface RootViewController:UITableViewController< UITableViewDelegate,UITableViewDataSource> {
MyViewController * myVC;
UINavigationController * navController;
AddViewController * addViewController;
NSArray * keys;
NSNumberFormatter * currencyFormatter;
}

RootViewController.m: b
$ b

  #importRootViewController.h
#importMyAppDelegate.h
#importMyViewController.h
#importAddViewController.h
#importEditingViewController.h
#importMyObject.h
#importViewCell.h
#importAppColors .h
#importCustomCellBackgroundView.h

//从此类管理编辑视图控制器,因此可以从detail和add控制器轻松访问它。
static EditingViewController * __ editingViewController = nil;

@implementation RootViewController


解决方案

RootViewController.m在它的某个地方有一个引用MyViewController,但是你没有链接到一个文件与 @implementation MyViewController 。 RootViewController.o是通过编译RootViewController.m创建的对象文件。


This one is new to me. Not even sure what RootViewController.o is? though this project does have a .m & .h. Building for Simulator 3.0. Cleaned before build (Shift-⌘-K).

Recently added some classes from another project that also had a RootViewController...but I didn't transfer old one over. Haven't built since. This could be part of the problem?!?

Building target "MyApp" of project "MyApp" with configuration "Debug" — (1 error)

    cd "/Volumes/MacHD/Development/iPhone/MyApp"
    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.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -L/Volumes/MacHD/Development/iPhone/MyApp/build/Debug-iphonesimulator -F/Volumes/MacHD/Development/iPhone/MyApp/build/Debug-iphonesimulator -filelist /Volumes/MacHD/Development/iPhone/MyApp/build/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -o /Volumes/MacHD/Development/iPhone/MyApp/build/Debug-iphonesimulator/MyApp.app/MyApp
Undefined symbols:
  ".objc_class_name_MyViewController", referenced from:
      literal-pointer@__OBJC@__cls_refs@MyViewController in RootViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Build failed (1 error)


Edit: Cleaned ALL targets... still won't build. Here's my #includes:

RootViewController.h:

#import <UIKit/UIKit.h>
#import "MyViewController.h" //tried with this and as @class MyViewController

@class AddViewController, EditingViewController;

@interface RootViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> {
    MyViewController *myVC;
    UINavigationController *navController;
    AddViewController *addViewController;
    NSArray *keys;
    NSNumberFormatter *currencyFormatter;
}

RootViewController.m:

#import "RootViewController.h"
#import "MyAppDelegate.h"
#import "MyViewController.h"
#import "AddViewController.h" 
#import "EditingViewController.h"
#import "MyObject.h"
#import "ViewCell.h"
#import "AppColors.h"
#import "CustomCellBackgroundView.h"

// Manage the editing view controller from this class so it can be easily accessed from both the detail and add controllers.
static EditingViewController *__editingViewController = nil;

@implementation RootViewController

解决方案

RootViewController.m has a reference in it somewhere to MyViewController, but you haven't linked in a file with an @implementation MyViewController in it. RootViewController.o is the object file created by compiling RootViewController.m.

这篇关于XCode链接构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆