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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:40:19+00:00 2026-05-23T10:40:19+00:00

#import <Foundation/NSArray.h> #import <Foundation/NSString.h> #import <Foundation/NSAutoreleasePool.h> #import <Foundation/NSEnumerator.h> #import <stdio.h> void print( NSArray *array

  • 0
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSEnumerator.h>
#import <stdio.h>

void print( NSArray *array ) {
NSEnumerator *enumerator = [array objectEnumerator];
id obj;

while ( obj = [enumerator nextObject] ) {
    printf( "%s\n", [[obj description] cString] );
}
}

int main( int argc, const char *argv[] ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *arr = [[NSArray alloc] initWithObjects:
                @"Me", @"Myself", @"I", nil];
NSMutableArray *mutable = [[NSMutableArray alloc] init];

// enumerate over items
printf( "----static array\n" );
print( arr );

// add stuff
[mutable addObject: @"One"];
[mutable addObject: @"Two"];
[mutable addObjectsFromArray: arr];
[mutable addObject: @"Three"];

// print em
printf( "----mutable array\n" );
print( mutable );

// sort then print
printf( "----sorted mutable array\n" );
[mutable sortUsingSelector: @selector( caseInsensitiveCompare: )];
print( mutable );

// free memory
[arr release];
[mutable release];
[pool release];

return 0;
}

this program compiled with oscv0.1.4 in windows.
it gives an error as shown below

Error: Parse error on line 6:
...import <stdio.h>

void print( NSArray 
---------------------^
Expecting 'INTERFACE', 'IMPLEMENTATION', 'PROTOCOL', 'IMPORT', 'CLASS', 'DEFINE', 'EOF'

now i got one more error for the program shown below(it is another program)

#import "Forwarder.h"
#import "Recipient.h"

int main(void)
{
    Forwarder *forwarder = [Forwarder new];
    Recipient *recipient = [Recipient new];

[forwarder setRecipient:recipient]; //Set the recipient.
[forwarder hello];

[recipient release];
[forwarder release];

return 0;
}

error is

Error: Parse error on line 3:
...Recipient : Object
- (id)hello;
@end#i
----------------------^
Expecting '<', '{'
  • 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-23T10:40:20+00:00Added an answer on May 23, 2026 at 10:40 am

    the format of your program must like the code shown below
    here main must contain Main class
    compare this with the link
    http://code.google.com/p/oscompiler/downloads/list

    @interface Main : NSObject { }
    @end
    
    @implementation Main
    +(void)main {
    NSLog(@"Hello world!");
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import java.lang.Math; public class NewtonIteration { public static void main(String[] args) { System.out.print(rootNofX(2,9)); }
#import <Foundation/Foundation.h> int main (int argc, char const *argv[]) { SampClass *obj=[[SampClass alloc] init];
#import<Foundation/Foundation.h><br/> #import QuestionItem.h int main (int argc, const char * argv[]) { NSAutoreleasePool *
I've got this code: Entry.h #import <Foundation/Foundation.h> @interface Entry : NSObject { id object;
UIView.h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> @interface UIView : UIResponder { IBOutlet UILabel *endLabel; IBOutlet
I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo { public static void main(String[]
import threading event = threading.Event() event.set() print event.wait(1) None event.clear() print event.wait(1) None So
import java.io.*; import java.util.Scanner; import java.util.StringTokenizer; public class Filereader { public static void main(String[]
If you import UIKit.h does that also automatically import Foundation.h?

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.