discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective-C newbie programming question


From: Dennis Leeuw
Subject: Objective-C newbie programming question
Date: Fri, 17 Jan 2003 16:05:14 +0100

Hi all,

From: http://www2.latech.edu/~acm/helloworld/objectivec.html
I stole a Hello World program, which you find below.
I figured the #include should be #include <objc/Object.h>
Which is all fine, but then when compiling I get:

bash-2.05a$ gcc -c hello.m -lobjc       
hello.m: In function `main':
hello.m:24: warning: return type of `main' is not `int'
gcc: -lobjc: linker input file unused because linking not done

Which I don't understand, cause it says void...
And when running the .o file I get:

bash-2.05a$ ./hello.o 
bash: ./hello.o: cannot execute binary file

Could someone help me out?

Thanks,

Dennis Leeuw

/* W.J. Antel Jr.  12/12/96       
** Compile with gnu's gcc:  gcc hello.m -lobjc
*/
#include 


@interface Control:Object

{
}
- world;
void main();

@end


@implementation Control

- world
{
  printf("Hello, World!\n");
}

void main()
{
  id hello;

  hello=[Control new];

  for(;;)
    [hello world];
}

@end




reply via email to

[Prev in Thread] Current Thread [Next in Thread]