As a personal training exercise I'm building a Calculator in xCode. Before I begin, here are the resouces:
YouTube Video 1: Building the interface
YouTube Video 2: Setting up the Outlets
Part 3: The source code, and a (better quality) Quicktime video explaining what it does.
All of my concerns are related to part 3, the programming part, but I put the first two parts for reference.
I had gone through the video step-by-step and reproduced the code by hand to the best of my ability, but as of now I have about 14 errors. That's down from about 27 errors, which is good I guess, but these last ones have me scratching my head. I've included the Regexkit.h file properly (I think) and done everything else as he has it laid out in the source code. I think all of my problems are in file CalcController.m and this is my first problem:
I don't understand what the compiler wants. It's exactly as the source code laid out. syntax error?
Next:
These errors are all in the math implementations (plus, subtract, divide, multiply) so there are four of them I think. Strictly:
Code: Select all
- (IBAction)push_plus: (id)sender {
//Basically, if any of the other buttons are on, then turn this button off?
if ([m_button state] == NSOnState || [s_button state] == NSOnState || [d_button state] == NSOnState);
[a_button setState:NSOffState];
}
else {
[self check_calc_model];
if (!calc_model.first_call)
[self push_equal:0];
calc_model.sign_state = 'a';
[calc_model computeNewDisplayVal:[calc_display floatValue]];
[calc_display setFloatValue:calc_model.running_total];
}
}
Lastly, this is the most frustrating:
Now I can sortof empathize with the error because that really *is* the first time calc_model shows up, but it's also (as far as I can tell) exactly as Chris M had coded it, so it *should* work, right?
Any pointers, tips, suggestions, etc. would be great.