Calling Cocoa APIs from a command line application
Calling Cocoa APIs from a command line application
- Subject: Calling Cocoa APIs from a command line application
- From: John Siracusa <email@hidden>
- Date: Sat, 13 Sep 2003 13:00:20 -0400
I want to call an NSWorkspace method from a simple command-line script. I
naively thought this would work:
#import <AppKit/NSWorkspace.h>;
int main(int argc, const char *argv[])
{
[[NSWorkspace sharedWorkspace]] noteFileSystemChanged:@"/foo/bar"];
return 0;
}
But it doesn't, and I get this error:
new.m:5: cannot find interface declaration for `NSConstantString'
So I add this:
#import <Foundation/NSString.h>
and get this error:
ld: Undefined symbols:
.objc_class_name_NSConstantString
.objc_class_name_NSWorkspace
__NSConstantStringClassReference
_objc_msgSend
So I punt and replace it with this:
#import <AppKit/AppKit.h>
and get this error:
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:109:
header file 'Foundation/NSURLError.h' not found
...and so on and so forth :) Can someone tell me what I'm doing wrong, or
point me to a tutorial on calling Cocoa APIs from basic command-line
programs?
-John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.