So I have this piece of code...
/**
* cdb.m
* Copyright (C) 2013 Naveen Mathew. All rights reserved.
*/
#import <objc/Object.h>
#import "cdb.h"
#import <stdio.h>
#import <stdlib.h>
@implementation CDB : Object
{
}
- (int) main {
printf("Hello world");
return 0;
}
@end
int main(void)
{
CDB *myNumber = [CDB new]; // equal to [[Number alloc] init]
[myNumber main];
return 0;
}
and I want to compile it in Ubuntu 13.04 but without all the crap that GNUStep gives me. So I use the GNU Objective C runtime (gobjc) but when I compile I get the following...
clang -Wall -lobjc -o cdb cdb.m -I/usr/lib/gcc/x86_64-linux-gnu/4.7/include
cdb.m:25:21: warning: class method '+new' not found (return type defaults to
'id') [-Wobjc-method-access]
CDB *myNumber = [CDB new]; // equal to [[Number alloc] init]
^ ~~~
1 warning generated.
and when I run the program I get a segmentation fault... I'm using gobjc 4.7. I tried it with gobjc 4.6... it compiles but I still get a segmentation fault...