1

I tried to compile this code:

// Frist program example 

#import Foundation/Foundation.h>

int main (int argc, const char * argv [])
{
  NSAutoreleasePool * pool - [[NSAutoreleasePool alloc] init];
  NSLog (@"Programming is fun!");

  [pool drain];
  return 0;
}     

but when I type in the filename an error message shows up from the compiler:

./prog1.m: line 1: //: is a directory
./prog1.m: line 6: syntax error near unexpected token '('
./prog1.m: line 6: 'int main (int argc, const char *argv [])'

Jonathan Sterling
  • 18,320
  • 12
  • 67
  • 79
ivy
  • 39
  • 1
  • 1
  • 5

1 Answers1

2

You've got a - where you want a =!

Try this:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv [])
{
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  NSLog (@"Programming is fun!");

  [pool drain];
  return 0;
}     
dcrosta
  • 26,009
  • 8
  • 71
  • 83
Jonathan Sterling
  • 18,320
  • 12
  • 67
  • 79