AppleScriptObjC & Key Codes

Hello everyone,
I was wondering if it was possible to run a shell script when a certain keystroke was pressed. Using http://macscripter.net/viewtopic.php?id=32217 I was able to learn the script:

The .m file

#import <Cocoa/Cocoa.h>

#import <AppleScriptObjC/AppleScriptObjC.h>

@implementation NSEvent (HotKeys)

+(void)registerHotKeys:(NSArray *) hotKeys notificationName:(NSString *) name {
    id center = [NSNotificationCenter defaultCenter];
    [NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) {
        for (id aKey in hotKeys){
            NSUInteger theKey = [[aKey valueForKey:@"keyCode"] integerValue];
            NSUInteger modifier = [[aKey valueForKey:@"modifier"] integerValue];
            if ([event keyCode] == theKey && [NSEvent modifierFlags] == modifier) {
                [center postNotificationName:name object:self userInfo:[aKey valueForKey:@"keyName"]];
            } 
        }
    }]; 
}
@end

The AppDelegate

script AppDelegate
	property parent : class "NSObject"
    
    on hotKeyDetected_(aNotification)
        log "Hurray!"
    end hotKeyDetected_
	
	on applicationWillFinishLaunching_(aNotification)
        current application's NSEvent's registerHotKeys_notificationName_({{keyName:"hotKey1", keyCode:44, modifier:786432}, {keyName:"hotKey2", keyCode:47, modifier:786432}}, "RDKeyDownNotification")
        set Noter to current application's NSNotificationCenter's defaultCenter()
        Noter's addObserver_selector_name_object_(me, "hotKeyDetected:", "RDKeyDownNotification", missing value)
	end applicationWillFinishLaunching_
	
	on applicationShouldTerminate_(sender)
		-- Insert code here to do any housekeeping before your application quits 
		return current application's NSTerminateNow
	end applicationShouldTerminate_
	
end script

But when I try to execute this script, I get the following message:
Undefined symbols for architecture x86_64:
“_main”, referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thanks,

TechExpertHD