Search code examples
objective-cxcodecommand-line

Xcode thrown into an endless loop by command line project


I'm trying to build a command-line > foundation application under XCode4. While running the app under LLVM 2.0 i get the following 3 errors:

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFContext.h:60:23: error: expected function body after function declarator [3]
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65:74: error: unknown type name 'CGCharCode' [3]
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65:94: error: unknown type name 'CGKeyCode' [3]

When setting the compiler to GCC 4.2 or LLVM GCC 4.2 it throws XCode into a loop and i have to force it to shut down.

The code in the main.h looks as follows.

#import <Foundation/Foundation.h>

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

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSMutableArray *items = [[NSMutableArray alloc] init];

    [items addObject:@"One"];
    [items addObject:@"Two"];
    [items addObject:@"Three"];
    [items insertObject:@"Zero" atIndex:0];

    for(int i = 0; i < [items count]; i++)
    {
        NSLog(@"%@", [items objectAtIndex:i]);
    }

    [pool drain];
    return 0;
}

Does anyone know a solution?


Solution

  • Oke so.. after lots of forums to be dug through I ended up uninstalling any XCode i had and cleaning out the developer directory. Redownloading XCode 3 and XCode 4. Installing both their own respective directories and what do you know.

    It works..!

    Probably some mess left from upgrading XCode 3 was making my XCode go loopy.