0

This is more then likely a very simple question but I am completely stumped by it (and more then a little embarrassed by the situation). I have the following code in a command line utility in xCode:

#include <CoreFoundation/CoreFoundation.h>

int main (int argc, const char * argv[]) {

    NSFileManager *filemgr = [NSFileManager defaultManager];

}

When I build the project I get an error that "'NSFileManager' is undeclared". If I add the line:

#include <Foundation/Foundation.h> 

my error count jumps from 3 to 3951 with all of the errors in the file "NSObjCRuntime.h". I don't think there is anything wrong with the code, but do I have something in the programing environment set up wrong?

Thanks for the help.

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
MrWizard54
  • 38
  • 3

2 Answers2

2

Those single quotes are not valid. Try this:

#import <Foundation/Foundation.h>
Donald Byrd
  • 7,668
  • 4
  • 33
  • 50
0

You also forgot your auto release pool, I don't think you should do such stuff yourself when you don't know what you are doing, and just let Xcode do the hard work for you.

There should ben a template available in the new project window for Foundation based command line tools.

Antwan van Houdt
  • 6,989
  • 1
  • 29
  • 52
  • When I created the project I didn't realize there was a difference between core foundation tools and foundation tools (honestly didn't eve notice the option). – MrWizard54 Aug 20 '10 at 13:17