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

  • Home
  • SEARCH
  • 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 6942915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:05:16+00:00 2026-05-27T13:05:16+00:00

I just started programming in objective-c(today) and I’m just doing some simple command line

  • 0

I just started programming in objective-c(today) and I’m just doing some simple command line examples but I’ve already run into something that has stumped me. I am getting a compiler error on lines 5 & 6 in main. Here is my code:

Fraction Interface:

#import <Foundation/Foundation.h>

@interface Fraction : NSObject
{
    int numerator, denominator; 
}

-(void)print; 
-(void)setDenominator; 
-(void)setNumerator; 

@end

Fraction implementation:

#import "Fraction.h"

@implementation Fraction
-(void)print {
    NSLog(@"%i/%i",numerator,denominator); 
}

-(void)setNumerator: (int) n {
    numerator = n; 
}

-(void)setDenominator: (int) d {
    denominator = d; 
}

@end

Main:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    @autoreleasepool {
        Fraction  *f1 = [[Fraction alloc] init]; 
        Fraction  *f2 = [[Fraction alloc] init];
    }
    return 0;
}

All 3 files are in the same folder. I’m using Xcode; if this is relevant information.

  • 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-05-27T13:05:17+00:00Added an answer on May 27, 2026 at 1:05 pm

    Looks like you forgot to add #import "Fraction.h" to the top of main.m, In the future adding the error you receive would be helpful.

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

Sidebar

Related Questions

I have just started learning Objective-C, I am reading Programming in Objective-C 3rd Edition
I just started programming in Objective-C. Prior to this I was primarily a C#
I just started to learn object oriented programming today and just by observation noticed
I have been doing python programming for my project and I have just started.
I just started programming and tried to write something but (of course) it failed.
I just started programming in Java, and I need to get a simple application
I've literally just started programming in assembly language this week and I'm having some
I have just started programming in Objective-C, I understand it only partially supports method
I just started programming in C# and was reading about dividing your application /
I have just started programming and have made a few small applications in C

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.