opensubscriber
   Find in this group all groups
 
Unknown more information…

g : gnustep-dev@gnu.org 18 May 2012 • 9:27AM -0400

Getting Objective-C 2.0 working
by Laurent Michel

REPLY TO AUTHOR
 
REPLY TO GROUP




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




_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu....
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.