Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7772397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:52:52+00:00 2026-06-01T16:52:52+00:00

I did every thing, at least I tried to do everything JUST like the

  • 0

I did every thing, at least I tried to do everything JUST like the tutorial, but it gives me now 5 errors and 1 warning…
I am just beginning with Objective-c, so please explain your solutions.

Here’s my code: (Errors marked and described in comments)

CalculatorViewController.h:

//
//  CalculatorViewController.h
//  Calculator
//
//  Created by Me on 06-04-12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CalculatorViewController : UIViewController {
    IBOutlet UILabel *display;
    CalculatorBrain *brain; // error: "Expected specifier-qualifier-list before 'CalculatorBrain':
    NSString *waitingOperation;
}

- (IBAction)digitPressed: (UIButton *)sender;

- (IBAction)operationPressed: (UIButton *)sender;

@end

CalculatorViewController.m:

//
//  CalculatorViewController.m
//  Calculator
//
//  Created by Me on 06-04-12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "CalculatorViewController.h"

@implementation CalculatorViewController 

- (CalculatorBrain *) brain { // error: "Expected ')' before 'CalculatorBrain'"
    if (!brain) { // error: "'brain' undeclared"
        brain  = [[CalculatorBrain alloc] init]; // error: "'CalculatorBrain' undeclared"
    }
    return brain;
} // warning: Control reaches end of non-void function

-(IBAction)digitPressed:(UIButton *)sender {
    if ([waitingOperation isEqualToString:@""]) {
        NSString *digit = [[sender titleLabel] text];
        [display setText:digit];
    }
    else {
        // Do calculations if everything works, now just log something to check if it works
        NSLog(@"Joepie!");
    }

}

-(IBAction)operationPressed:(UIButton *)sender {

}

- (void)dealloc {
    [super dealloc];
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:52:53+00:00Added an answer on June 1, 2026 at 4:52 pm

    You are missing

    #import "CalculatorBrain.h"
    

    at the top of your .h file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did everything in Windows XP 32bit-with 4GB RAM, but thought why not install
I just did a fresh install of Apache server 2.2. Everything works. When I
i tried to do tutorial from http://developer.android.com/resources/tutorials/opengl/opengl-es20.html But what I wanted was to create
I just did a fresh install of Lion and now my app doesn't seem
My fellow programmers did not think to add timestamps to every tables of our
I did everything as it is written in the book of Vaswani V. -
I believe that I did everything necessary to change my app for ipad (was
In my app, I am upgrading from Cocos2D version 1.10->2.0-rc0a. So I did everything
I did heroku create and pushed a working rails app to the server. Everything
Did you ever have the following situation: you need to store information, but a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.