• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Calling Cocoa APIs from a command line application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Calling Cocoa APIs from a command line application
      • From: Dave Keck <email@hidden>
    • Re: Calling Cocoa APIs from a command line application
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Re: Another autorelease question
  • Next by Date: Re: Calling Cocoa APIs from a command line application
  • Previous by thread: Re: Another autorelease question
  • Next by thread: Re: Calling Cocoa APIs from a command line application
  • Index(es):
    • Date
    • Thread