【问题标题】:coregraphics on gnustep ubuntugnustep ubuntu 上的核心图形
【发布时间】:2013-04-22 11:37:49
【问题描述】:

所以我正在考虑将一些为我的 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 中的特定模块?

【问题讨论】:

    标签: objective-c ubuntu-12.04 quartz-2d gnustep


    【解决方案1】:

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

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

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

    【讨论】:

    • GNUstep 的 CoreGraphics 实现称为 Opal。
    • 感谢您的信息。我想我必须阅读更多关于 gnustep 历史的信息。感谢弗雷德的提醒。在研究了 opal 和 cocotron 之后,我发现 cocotron 和 opal 对 corgraphics 的实现都不足以满足我的需求:(考虑到我必须做大量额外的工作来尝试并成功移植,但不能保证成功,我可能会以及从头开始写一些在 ubuntu 上运行的东西:/
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-09
    相关资源
    最近更新 更多