[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Getting Objective-C 2.0 working
From: |
Laurent Michel |
Subject: |
Getting Objective-C 2.0 working |
Date: |
Thu, 17 May 2012 21:27:45 -0400 |
Dear All,
I develop on MaOS and would love to port my code to Linux. Essentially, I use
Objective-C 2.0 with clang as a compiler.
I created an Ubuntu 12.04 VM under VMWare and installed GNUStep through that
channel. I compiled a silly hello world and that worked fine.
My problems started when I tried to compile my own code which makes *heavy* use
of Objective-C blocks. I always end-up seeing this message:
clang -I/usr/GNUstep/System/Library/Headers -fblocks -fobjc-nonfragile-abi -c
CPFactory.m
In file included from CPFactory.m:27:
In file included from ./CPFactory.h:27:
In file included from
/usr/GNUstep/System/Library/Headers/Foundation/Foundation.h:30:
/usr/GNUstep/System/Library/Headers/GNUstepBase/GSVersionMacros.h:287:14: fatal
error: 'objc/blocks_runtime.h' file not found
namely, it cannot find objc/blocks_runtime.h
I started googling around and I found lots of conflicting information on the
topic as well as reference to Etoile, and ObjectiveC2 (a framework) but it
seems largely incompatible with GNUStep. I'll looking for some directions to
get going with a simple code that uses blocks. For instance, a silly test like:
#import <Foundation/NSObject.h>
int foo(int (^b)(int)) {
return b(5);
}
int main() {
int y = 10;
int z = foo(^(int x) {
return y + x;
});
NSLog(@"result is %d\n",z);
}
Should compile and run when linked against the Foundation framework.
Any pointer is greatly appreciated.
--
Laurent
- Getting Objective-C 2.0 working,
Laurent Michel <=