#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    66
    Rep Power
    2

    This is my first time ever


    This is my first time ever trying to learn Objective C so I got a Objective C text book and when I entered one of the examples into my computer and tried to compile it I got many error flags


    Code:
    /*
    Language = Objective C 
    Name = Beginnings.m 
    Author = Doodle Tech
    Version = 1.1
    Target User = Me 
    Target Operating System = Mac OS.X Mountain Lion 10.8.2
    Functional Requirements = print out some text
    Description = A program that prints out "Hello World"
    */ 
    
    #import <Foundation/Foundation.h> 
    
    int main (int argc, const char * argc[])
    {
    	@autoreleasepool {
    		NSLog (@"Hello World");
    	}
    	return 0; 
    }
    what is wrong with this? Thanks
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,392
    Rep Power
    1871
    Step 1 is to also post your error messages.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    66
    Rep Power
    2
    b.m:14: error: conflicting types for ‘argc’
    b.m:14: error: previous definition of ‘argc’ was here
    b.m: In function ‘main’:
    b.m:16: error: stray ‘@’ in program
    b.m:16: error: ‘autoreleasepool’ undeclared (first use in this function)
    b.m:16: error: (Each undeclared identifier is reported only once
    b.m:16: error: for each function it appears in.)
    b.m:16: error: expected ‘;’ before ‘{’ token
    untitled:programing account_login$


    these seem to be errors in basically the whole program
  6. #4
  7. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    You're using "argc" twice. One should be (typically) argv, though it could be any valid other label.

    Proofread.

    Since I don't know Objective C, I won't comment on additional errors.
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    77
    Rep Power
    0
    try this

    #include<stdio.h>

    main(){
    printf("Hello World");// display hello world
    return 0;

    }

IMN logo majestic logo threadwatch logo seochat tools logo