[TxMt] Problem with imported files in Objective-C

Nevan King nevan.ml at gmail.com
Wed Oct 19 11:34:00 UTC 2011


Hi

I'm doing some Objective-C exercises in TextMate. Up until now, I've
put everything (interface, implementation and main) into one file and
hit cmd-R (presumably activating the C bundle's Run command) to see
the output. Now I want to use separate files, with the #import
command. Unfortunately, when I try this, I get an error about how my
class can't be found. Here's the code :

#import "Rectangle.h"

int main (int argc, char *argv[]) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    Rectangle *rectangle = [[Rectangle alloc] init];

    [pool drain];
    return 0;
}

And the error it gives:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_Rectangle", referenced from:
      objc-class-ref in ccccStDD.o
ld: symbol(s) not found for architecture x86_64

I understand that I can do this in Xcode, or using the terminal, but
since I'm making quick changes, I want to see the results quickly.
Making a change and hitting cmd-R let me do this easily.

I looked at the Xcode bundle, which also has a "Run" command, but it
seems to require an Xcode project to work.

Is there a way to get my files to link automatically before running? Thanks.

Nevan


More information about the textmate mailing list