2013-04-22 24 views
0

所以即时考虑将一些为我的ios应用程序编写的逻辑移植到服务器上。 我正在构建视图层次,然后将其栅格化为位图coregraphics on gnustep ubuntu

我已经使用chameleon成功地将相关位移植到mac os。

现在我想尝试将它移植到Ubuntu上,因为GNUstep在AppKit上有一个开放的实现。我设法让你好世界应用程序工作。但是,对我来说,下面的代码在编译时会出错,这似乎很奇怪。

#import <Foundation/Foundation.h> 
#import <AppKit/AppKit.h> 

int main (int argc, const char * argv[]) 
{ 
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 
    [NSApplication sharedApplication]; 
     NSRunAlertPanel(@"Random",@"hello from GNUStep Appkit!",@"close this window",@"Another Button",nil); 
    NSView *view = [[NSView alloc]init]; 
    view.layer; 
    CGRect rect; 
     [pool drain]; 
     return 0; 
} 

错误:

hello.m: In function ‘main’: 
hello.m:10:6: error: request for member ‘layer’ in something not a structure or union 
hello.m:11:2: error: unknown type name ‘CGRect’ 

这似乎很奇怪,我认为这些错误应该被抛出,因为我相信CoreGraphics中坐在下面了AppKit。我错过了gnustep中的特定模块吗?

回答

0

据我所知,CoreGraphics没有在GNUstep中实现;我相信虽然Cocotron有一个实现。

错误error: request for member ‘layer’ in something not a structure or union是指表达式view.layer,您打算从view对象返回layer属性。该语法来自Objective-C 2.0,上次我知道,它并不支持GNUstep,有关启用它的信息(以及它对GNUstep的限制),请查询ObjC2FAQ

与此同时,您可以改为使用原始的Objective-C语法:[view layer]

+0

GNUstep的CoreGraphics实现被称为Opal。 – 2013-04-22 22:19:17

+0

感谢您的信息。我猜你必须阅读更多gnustep历史。感谢弗雷德抬起头来。在研究了蛋白石和cocotron后,我发现无论是cocotron还是蛋白石的corgraphics实现都不足以满足我的需求:(考虑到我必须做的额外工作量才能尝试并成功移植到端口,而且没有成功保证,我可能会以及从头开始写一些在ubuntu上运行的东西:/ – tzl 2013-04-23 02:36:35