A little help with my XCODE project

Discussion in 'Mac Programming' started by cybrscot, Feb 9, 2011.

  1. cybrscot macrumors 6502

    cybrscot

    Joined:
    Dec 7, 2010
    Location:
    Somewhere in Southeast Asia
    #1
    Hey team,
    I decided to do a simple Xcode project from another book, just to keep it interesting and get familiar with Xcode. A couple things, the book doesn't specify which version of Xcode it's using, but the book was printed in 2009 and I downloaded Xcode in December of 2010. The only difference I've seen so far is in the Library Window. The book says the Library window has two tabs: Objects and Media. The book also shows pictures of the Xcode windows, and I see that the Library window picture shows it with only those two tabs. However my LIbrary window has 3 tabs. I have Objects/Classes/Media. So maybe they just moved things around in an Xcode update?

    I'm following along with a simple calculator project in the book, everything is done and looks perfect, but when I "build and run" in Xcode, I'm getting an error in the code. I've included the code from my Xcode project. It's exactly as the book shows. I don't see any spelling errors either ! :D

    My copy and past didn't carry over the errors from my build, so I inserted them as comments. It said that two items were undeclared. Obviously the first thing I did was just add them to the int and declare them. But then it said that they were not used. :confused::confused:

    I added them to the int declaration, even though they didn't do that in the book, only because that was the error that was returned by the Xcode compiler. Take a look please. Thanks


    Code:
    //
    //  Fusebox.m
    //  MyfirstApp
    //
    //  Created by Scott Dean on 2/9/11.
    //  Copyright 2011 __MyCompanyName__. All rights reserved.
    //
    
    #import "Fusebox.h"
    
    
    @implementation Fusebox
    
    - (IBAction)calculateAnswer: (id)sender
    {
    	int num1, num2, answer; 
    	num1 = [numberField1 intValue];             //!numberField1 undeclared
    	num2 = [numberField2 intValue];             //!numberField2 undeclared
    	answer = num1 + num2;
    	
    	[answerField setIntValue:answer];
    }	
    
    @end
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
  3. cybrscot thread starter macrumors 6502

    cybrscot

    Joined:
    Dec 7, 2010
    Location:
    Somewhere in Southeast Asia

Share This Page