views:

708

answers:

3

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
+1  A: 

Try to clean all targets before building. If this doesn't work, post the code for RootViewController.h and .m, especially the #includes. The .o extension refers to the object file created by your compiler.

Dan Lorenc
you can now find the includes above...
Meltemi
+2  A: 

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.

Rob Napier
Hi Rob, Thanks again for your help. I #import MyViewController.h (MVC) from within RootViewController.m. (RVC) and I've tried @class MVC and #import MVC.h from within RVC.h. What does this "symbol(s) not found" mean? what "symbol" is the compiler talking about?
Meltemi
Meltemi: You're talking about preprocessing, which is completely separate from linking. `#import` has nothing to do with linking. You need to make sure MyViewController.m is added to your target.
Peter Hosey
Meltemi
+1  A: 

There is also another thing to do: check in the file list when you select the "Classes" group. The checkbox next to the .m files must be enabled (which tells XCode to compile and link the file) especially if u add them with "Add existing files..." command.

Istvan