我一直在搞乱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$
我的主要是:
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$
我已经google了,我已经确定我已经设置了GNUStep env变量,并且我正在使用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导入,所以任何想法出了什么问题?