【发布时间】:2011-06-25 23:16:38
【问题描述】:
我终于让 GNUstep 工作(在 Windows 上),它编译并运行良好。但是,每当我尝试使用 NSLog 时,都会收到以下错误:
$ gcc -o hello hello.m -I /GNUstep/System/Library/Headers \
> -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base
hello.m: In function 'main':
hello.m:4:5: error: cannot find interface declaration for 'NXConstantString'
我的源代码:
#import <Foundation/Foundation.h>
int main(void) {
NSLog(@"hello world");
}
【问题讨论】:
-
经过更多的试验,似乎每当我的字符串前有一个 @ 时,我都会收到此错误,而不仅仅是在我使用 NSLog 时。
-
在您的字符串之前没有
@会使它成为纯C 字符串,这是用于NSLog格式字符串的错误类型。
标签: objective-c cocoa gcc nslog gnustep