我终于让 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(@"hello world");
不是
NSlog(@"hello world"); // 'l' should be upper case in NSLog
试试这个-
gcc -o hello hello.m -I /usr/lib/GNUstep/System/Library/Headers \
-L /usr/lib/GNUstep/System/Library/Libraries/ -lgnustep-base \
-fconstant-string-class=NSConstantString
关于objective-c - NSLog 错误 : Can't find 'NXConstantString' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4976351/