views:

49

answers:

2

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.

+2  A: 

Those single quotes are not valid. Try this:

#import <Foundation/Foundation.h>
ongle
Single quotes were an artifact of me not using stackoverflow's markdown wrong. Post updated.
MrWizard54
A: 

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
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