GCC configured for ObjC...but can't do it?!
Kevin Ingwersen
ingwie2000@googlemail.com
Wed Dec 4 10:27:00 GMT 2013
Hey!
I finally got to compile gcc-4.8.2 with objc and objc++ enabled. Now, I tried to compile a test programm:
#import <Foundation/Foundation.h>
#include <stdio.h>
@interface Test : NSObject {
int foo;
}
- (void)SayHi;
@end
@implementation Test
- (void)SayHi {
printf("You made it into objc.");
}
@end
int main(void) {
Test *iTest;
iTest = [[Test alloc] init];
[iTest SayHi];
}
And this is what I get:
root@Ingwies-Air ~/Work/objc $ gcc -framework Foundation test2.m
In file included from /usr/include/os/object.h:74:0,
from /usr/include/dispatch/dispatch.h:48,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/objc/NSObject.h:21:26: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
- (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:35:14: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
- (id)retain OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:36:24: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
- (oneway void)release OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:37:19: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
- (id)autorelease OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:38:27: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
- (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:48:1: error: unknown type name ‘OBJC_ROOT_CLASS’
OBJC_ROOT_CLASS
^
/usr/include/objc/NSObject.h:50:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘interface’
@interface NSObject <NSObject> {
^
/usr/include/objc/NSObject.h:69:63: error: expected ‘:’ before ‘;’ token
+ (id)copyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
^
In file included from /usr/include/dispatch/dispatch.h:50:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/dispatch/object.h:249:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t finalizer);
^
In file included from /usr/include/dispatch/dispatch.h:52:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/dispatch/queue.h:180:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
/usr/include/dispatch/queue.h:246:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
/usr/include/dispatch/queue.h:651:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
/usr/include/dispatch/queue.h:731:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
/usr/include/dispatch/queue.h:790:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
/usr/include/dispatch/queue.h:832:17: error: unknown type name ‘dispatch_function_t’
void *context, dispatch_function_t destructor);
^
In file included from /usr/include/dispatch/dispatch.h:53:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/dispatch/source.h:405:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t handler);
^
/usr/include/dispatch/source.h:464:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t cancel_handler);
^
/usr/include/dispatch/source.h:739:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t registration_handler);
^
In file included from /usr/include/dispatch/dispatch.h:54:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/dispatch/group.h:123:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
/usr/include/dispatch/group.h:233:2: error: unknown type name ‘dispatch_function_t’
dispatch_function_t work);
^
In file included from /usr/include/dispatch/dispatch.h:56:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/dispatch/once.h:79:3: error: unknown type name ‘dispatch_function_t’
dispatch_function_t function);
^
/usr/include/dispatch/once.h:85:3: error: unknown type name ‘dispatch_function_t’
dispatch_function_t function)
^
In file included from /usr/include/dispatch/dispatch.h:57:0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
from test2.m:1:
/usr/include/dispatch/data.h:85:1: error: unknown type name ‘dispatch_function_t’
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free);
^
/usr/include/dispatch/data.h:94:1: error: unknown type name ‘dispatch_function_t’
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap);
^
…solutions? o.o;
Kind regards, Ingwie
More information about the Gcc-help
mailing list