// Hello.m
#import
@interface HelloWorld : NSObject {
// no instance variables
}
// methods
- (void)sayHello;
@end
@implementation HelloWorld
- (void)sayHello
{
NSLog(@"Hello, world, at %@", [NSCalendarDate calendarDate]);
}
@end
int main() {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// my stuff
HelloWorld *hw = [[HelloWorld alloc] init];
[hw autorelease];
[hw sayHello];
[pool release];
return 0;
}
// GNUmakefile
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = Hello
Hello_OBJC_FILES = Hello.m
include $(GNUSTEP_MAKEFILES)/tool.make
moia:bzero:~/objc> gmake
This is gnustep-make 2.0.8. Type 'make print-gnustep-make-help' for help.
Making all for tool Hello...
Compiling file Hello.m ...
Linking tool Hello ...
http://drunkenprogrammerblog.blogspot.com/2011/01/start-with-objective-c-on-windows.html
ResponderExcluir