views:

328

answers:

1

I'm doing a short project just to experiment writing without the use of nib files (personal interest only, don't plan on never using nibs!).

I have my app controller set up as NSApp's delegate. Under -(void)applicationDidFinishLaunching:(NSNotification *)aNotification, I attempt to initialize the interface.

AppController.h:

#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>

@interface AppController : NSObject {

NSWindow* mainWindow;
QTMovieView* movieView;
QTCaptureSession* mainSession;
QTCaptureMovieFileOutput* output;
QTCaptureDeviceInput* video;
QTCaptureDeviceInput* audio;

}

+ (void)initialize;
- (id)init;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;

@end

Method in AppController.m

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {


//Proceed to initialize the entire interface:

mainWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(500, 300, 700, 500)
styleMask:(NSTitledWindowMask|NSClosableWindowMask|
  NSMiniaturizableWindowMask|NSResizableWindowMask) 
backing:NSBackingStoreBuffered
defer:NO];

[mainWindow setTitle:@"Record a movie!"];

/*movieView = [[QTMovieView alloc] initWithFrame:NSMakeRect([[mainWindow contentView] bounds].origin.x + 5, 
            [[mainWindow contentView] bounds].origin.y + 30,
                   [[mainWindow contentView] bounds].size.width - 10, 
                   [[mainWindow contentView] bounds].size.height - 35)];*/

[[mainWindow contentView] addSubview:movieView];

[mainWindow makeKeyAndOrderFront:NSApp];

}

The part commented out is the origin of the 1 error that doesn't appear in the text editor, only in the "build" panel:

<pre> ".objc_class_name_QTMovieView", referenced from:  
literal-pointer@_OBJC@_cls_refs@QTMovieView in AppController.o
symbol(s) not found
collect2: Id returned 1 exit status

There seems to be a problem with alloc/init'ing an instance here. I can declare a new one just fine, i.e. QTMovieView *test; and nothing complains. I've also found that it does the same thing with all the other QT classes when I try to alloc/init them. However, I was able to alloc/init NSWindow just fine. The framework is in my project and as you can see in my .h file, I included QTKit.

Anyone know what's going on?

+4  A: 

The error you're getting is a linker error -- the linker (ld) can't find the framework object code for the QTMovieView class. Therefore, you haven't included the QTKit framework in your project. If you think you have, then something about it isn't set up properly.

Adam Rosenfield
Thanks, turned out I had added "QuickTime.framework" instead of "QTKit.framework"... bleh...