• 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
CoreFoundation Command Line Tool - an easy beginner question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreFoundation Command Line Tool - an easy beginner question


  • Subject: CoreFoundation Command Line Tool - an easy beginner question
  • From: Steve Cronin <email@hidden>
  • Date: Mon, 04 Aug 2008 13:51:42 -0500

Folks;

Here's the pretty simple tool I'm trying to create (THANK-YOU Michael Ash!!)

int main (int argc, const char * argv[]) {
char dummy;
read(STDIN_FILENO, &dummy, 1);
[NSAutoreleasePool new];
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]];
LSOpenCFURLRef((CFURLRef)url, NULL);
return 0;
}


I'm using XCode3.1 with the 10.5 SDK deploying to 10.4.
I open new project using the CoreFoundation - Command Line Tool template, and place the code shown above.


My question is what are the #imports necessary to make this work?
I have figured out:
#import <unistd.h> //for the STDIN_FILENO and the read()
#import <ApplicationServices/ApplicationServices.h> //for the LSOpenCFURLRef


I've tried various usages of #import <Foundation/Foundation.h> but can't seem to get it right so that NSURL & NSAutoreleasePool are defined...
I believe that both NSURL and NSAutoreleasePool are defined in the Foundation framework, which is why I am focused on getting it #imported, I just need the syntax..
(with Foundation framework added to the project)
NO --> #include <Foundation/Foundation.h> (~700 errors...)
NO --> #include <Foundation/NSURL.h> (45 errors..)


Oh out of exasperation, I tried <Cocoa/Cocoa.h> ---> ~1700 errors

I know this is probably pretty easy for most, but its got me just bamboozled....

THANK-YOU for any help!
Steve
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: CoreFoundation Command Line Tool - an easy beginner question
      • From: Chris Parker <email@hidden>
    • Re: CoreFoundation Command Line Tool - an easy beginner question
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: help linking sqlite3 wrapper
  • Next by Date: Re: CoreFoundation Command Line Tool - an easy beginner question
  • Previous by thread: Re: Message Framework and Garbage Collection
  • Next by thread: Re: CoreFoundation Command Line Tool - an easy beginner question
  • Index(es):
    • Date
    • Thread