1

我一直在搞乱 GNUStep,我有一个简单的 main.m,它编译得很好。我想看看objective-c库(用于ios/mac)是否与GNUStep一起工作,所以我下载了JSONKit并试图编译它,但我一直收到这个错误:

mark@Emperor:~/objc-test2$ make
This is gnustep-make 2.6.2. Type 'make print-gnustep-make-help' for help.
Making all for tool Test...
Compiling file JSONKit.m ...
In file included from JSONKit.m:110:0:
JSONKit.h:63:21: warning: "/*" within comment [-Wcomment]
In file included from /usr/include/GNUstep/Foundation/NSAttributedString.h:143:0,
             from /usr/include/GNUstep/Foundation/Foundation.h:42,
             from JSONKit.h:72,
             from JSONKit.m:110:
/usr/include/GNUstep/GNUstepBase/NSAttributedString+GNUstepBase.h:44:1: error: cannot find interface declaration for ‘NSAttributedString’
make[3]: *** [obj/Test.obj/JSONKit.m.o] Error 1
make[2]: *** [internal-tool-all_] Error 2
make[1]: *** [Test.all.tool.variables] Error 2
make: *** [internal-all] Error 2
mark@Emperor:~/objc-test2$

我的 main.m 是这样的:

mark@Emperor:~/objc-test2$ cat main.m
#import <stdio.h>
#include <Foundation/Foundation.h>
#import "Fraction.h"
#import "JSONKit.h"
    int main( int argc, const char *argv[] ) {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        // create a new instance
        Fraction *frac = [[Fraction alloc] init];

        // set the values
        [frac setNumerator: 1];
        [frac setDenominator: 3];

        // print it
        NSLog(@ "The fraction is: %@", [frac print]);

        // free memory
        [frac release];

        NSMutableArray *testArr = [[NSMutableArray alloc] initWithCapacity:0];
        [testArr addObject:[NSNumber numberWithInt:2]];
        [testArr addObject:@"Hey"];
        NSLog([testArr JSONString]);


        [pool drain];
        return 0;

    }
mark@Emperor:~/objc-test2$

我已经四处搜索,并确保我设置了 GNUStep 环境变量,并且我正在使用一个 make 文件(取自在线示例)

mark@Emperor:~/objc-test2$ cat GNUmakefile
include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME  = Test
Test_OBJC_FILES = main.m Fraction.m JSONKit.m
Test_CPPFLAGS = $(RUNTIME_DEFINE)
# Include in the rules for making Objective-C programs
include $(GNUSTEP_MAKEFILES)/tool.make
mark@Emperor:~/objc-test2$

我真的不明白这一点,因为 /Foundation/NSAttributedString.h 清楚地包含 NSAttributedString 和 NSAttributedString+GNUStepBase.h 的接口声明,所以知道出了什么问题吗?

4

0 回答 0