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 4274032
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:47:32+00:00 2026-05-21T07:47:32+00:00

Hey all, I’m new to programming and going through an objective-c book to learn

  • 0

Hey all, I’m new to programming and going through an objective-c book to learn the language and programing fundamentals. I’ve looked through the code repeatedly, went back to the book’s example, and attempted to understand the gcc comple errors. Here’s my code:

#import <stdio.h>
#import <objc/Object.h>

@interface Point: Object
    {
        int xaxis;
        int yaxis;
    }

    -(void) print;
    -(void) setx:   (int)x;
    -(void) sety:   (int)y;

@end

@implementation Point;

    -(void) print
        {
            printf("(%i,%i)", xaxis, yaxis);
        }

    -(void) setx:   (int) x
        {
            xaxis = x;
        }

    -(void) sety:   (int) y
        {
            yaxis = y;
        }
@end

int main (int argc, char *argv[])
    {
        Point *myPoint;

        myPoint = [Point alloc];

        myPoint = [myPoint init];

        [myPoint setx: 4];
        [myPoint sety: 5];

        printf("The coordinates are: ");
            [myPoint print];
        printf("\n");

        [myPoint free];

        return 0;

    }

Then the compile errors from gcc look like this:

urban:Desktop alex$ gcc point.m -o point -l objc
point.m: In function ‘main’:
point.m:38: warning: ‘Point’ may not respond to ‘+alloc’
point.m:38: warning: (Messages without a matching method signature
point.m:38: warning: will be assumed to return ‘id’ and accept
point.m:38: warning: ‘...’ as arguments.)
point.m:40: error: ‘mypoint’ undeclared (first use in this function)
point.m:40: error: (Each undeclared identifier is reported only once
point.m:40: error: for each function it appears in.)
point.m:49: warning: ‘Point’ may not respond to ‘-free’

Where am I going wrong?

btw I’m going through “Programming in Objective-C” by Stephen Kochan if you wanted to know.

  • 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-21T07:47:33+00:00Added an answer on May 21, 2026 at 7:47 am

    You have warnings and an error. The warnings seem to suggest that Object, which you are subclassing, doesn’t implement alloc, init or free. Normally, on an Apple platform, you’d subclass NSObject, which does implement these, but without knowing which platform you’re on, it’s not possible to advise the correct option.

    Secondly, you had a typo, but that now seems to be corrected. This

    point.m:40: error: ‘mypoint’ undeclared (first use in this function)
    

    suggests that you had mypoint in your code, rather than myPoint.

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

Sidebar

Related Questions

Hey all, i am trying to learn how to insert a comment within some
Hey all- I have looked this up on here and Google but none of
Hey all, I'm a total noob when it comes to Objective-C / iPhone development.
Hey all. I have the following code: http://jsfiddle.net/g7Cgg/ As you can see, there are
Hey All, I am a pointer newbie and in the following code, I am
Hey all i am trying to find some code that would allow me to
Hey all, I'm using this code to change my sIFR (version 3) H1 and
Hey all i am new at C# and i am trying to call the
Hey all, I'm still relatively new to Java, and looking for a sanity check.
Hey all, my Computational Science course this semester is entirely in Java. I was

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.