Today it helped me to compile a standard (or GNUStep ?) Objective-C program with gcc.
Here is the code:
#include <objc/Object.h>The command to compile is the following:
#include <stdio.h>
#include <stdio.h>
@interface Test : Object
{
}
- (void) sayHello;
@end;
@implementation Test
- (void) sayHello
{
printf("Hello\n");
}
@end
int main(void)
{
id t;
t = [Test new];
[t sayHello];
[t free];
return 0;
}
gcc -arch i386 test.m -o test -lobjc
It means that the output file ./test supports the Mach-O architecture. You can verify it as:
file ./test
The output:
./test: Mach-O executable i386
No comments:
Post a Comment