MyClass.h:
#import <objc/Object.h>
@interface MyClass : Object {
}
- (void) sayHello;
MyClass.m:
#import "MyClass.h"
#import <stdio.h>
@implementation MyClass : Object {
}
- (void) sayHello { printf("Hello, World!\n"); }
main.m:
#import <objc/objc.h>
#import "MyClass.h"
int main() {
MyClass *anObject;
anObject = [[MyClass alloc] init];
[anObject sayHello];
return 0;
}
I compiled this using the following:
gcc -o hello -lobjc MyClass.m main.m