ivy
ivy

Reputation: 39

Is something wrong with my GNUstep compiler?

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 [])'

Upvotes: 1

Views: 245

Answers (1)

Jonathan Sterling
Jonathan Sterling

Reputation: 18385

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;
}     

Upvotes: 2

Related Questions