因此,我正在考虑将为ios应用程序编写的一些逻辑移植到服务器上。我正在构建一个视图层次结构,然后将其栅格化为位图
我已经使用chameleon成功地将相关的位移植到mac os。
现在我想试着把它移植到ubuntu上,因为GNUstep在AppKit上有一个开放的实现。我设法让hello world应用程序正常工作。然而,对我来说,这似乎比以下在编译时抛出的错误更奇怪。
#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中的某个模块?
发布于 2013-04-23 06:01:16
据我所知,GNUstep没有实现CoreGraphics;但我相信Cocotron有一个实现。
错误error: request for member ‘layer’ in something not a structure or union引用表达式view.layer,您打算从view对象返回该表达式的layer属性。该语法来自Objective-C2.0,GNUstep不支持它,据我所知,有关启用它的信息,请查看ObjC2FAQ (以及它在GNUstep上的限制是什么)。
同时,您可以使用原始的Objective-C语法:[view layer]。
https://stackoverflow.com/questions/16146242
复制相似问题