Amazon.com Widgets Need a glance over my shoulder.
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 31, 2014, 04:21:57 PM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Chapter Study
| | |-+ Chapter 2 - Programming in Objective-C
| | | |-+ Need a glance over my shoulder.
Pages: [1] Go Down
Print
Author Topic: Need a glance over my shoulder. (Read 1151 times)
Tervicz
Newbie
*
Posts: 2






on: September 16, 2011, 01:05:18 PM

I am running OSX.7.1 and using Xcode 4.1. Here is my code:
Code: (Objective-C)
//
//  main.c
//  pgrm1
//
//  Created by Steven on 9/16/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   
    NSLog(@"I will not be beaten!");
   
    [pool drain];
    return 0;
}
Running it fails and returns me with 20 errors. 17 parse errors in NSObjRuntime.h, NSZone.h and NSObject.h as well as two Semantic Issues with NSObjRuntime.h and lastly a LLVM compiler 2.1 error. Is it a syntax error or am I missing something? Thanks in advance.
Logged
fujilla
Global Moderator
Sr. Member
*****
Posts: 276


WWW




Reply #1 on: September 16, 2011, 01:16:06 PM

It looks like you have created, and are trying to run a C file through the Objective-C compiler.

I don't know how you could have done that as when you create a command line tool project it creates main.m, whereas you have main.c  Shocked

Nick
http://myfirstiphoneapp.co.uk
Logged
Tervicz
Newbie
*
Posts: 2






Reply #2 on: September 16, 2011, 01:25:40 PM

Ah HAH! Good call. I looked further back in the book and I made the mistake of not selecting "Foundation" from the project type drop down menu. I left it as the default C.

Thanks, bro!
Logged
fujilla
Global Moderator
Sr. Member
*****
Posts: 276


WWW




Reply #3 on: September 16, 2011, 01:30:11 PM

Ah yeah, I'm so used to just leaving it as Foundation that I haven't looked to see whatever else is there.  Embarrassed
Logged
Pages: [1] Go Up
Print
Jump to:



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents (c) 2009 classroomM.com. All rights reserved.